3 Replies - 2616 Views - Last Post: 28 May 2013 - 03:16 AM Rate Topic: -----

#1 itzmePoulami  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 12-March 13

Message boxes in C#.net website

Posted 27 May 2013 - 04:30 AM

I want to create a messagebox with OK and CANCEL buttons and then write code according to the selection.. Can anyone help me out.. I need it urgently.. :helpsmilie:/>

So far I've done :

DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete this record?", "WARNING !!!", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
        {
        Button btn = (Button)sender;
        GridViewRow gvrw = (GridViewRow)btn.NamingContainer;
        Label lblVenID = (Label)gvrw.FindControl("lblVendorID");
        hfVendorID.Value = lblVenID.Text;
        DataSet dsdel = objMVendorBL.DeleteVendor(hfVendorID.Value);
        FillGrid();
        else if (dialogResult == DialogResult.No)
        {
        }


But it gives error: The type or namespace name 'DialogResult' could not be found
The name "MessageBox" doesnot exist in the current context

:helpsmilie:/>

This post has been edited by JackOfAllTrades: 28 May 2013 - 03:33 AM
Reason for edit:: Added code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Message boxes in C#.net website

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,436
  • Joined: 23-August 08

Re: Message boxes in C#.net website

Posted 27 May 2013 - 04:43 AM

Why did you post a ASP.NET/C# question in the Databases forum???

Moved to ASP.NET.

And USE CODE TAGS!!!

:code:

Quote

I need it urgently


Not our problem, and when you post that, it makes people LESS likely to want to help you.
Was This Post Helpful? 0
  • +
  • -

#3 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,501
  • Joined: 16-March 11

Re: Message boxes in C#.net website

Posted 27 May 2013 - 06:42 AM

First you can't use Message boxes in asp.net. It will fire a messagebox on the server where the client using the website won't see and could further halt your website from proceeding. You have to use Javascript or you can go download the Ajax Toolkit and try using their already built toolkit which is written to do a lot of Javascript behind the scenes for you.
Was This Post Helpful? 0
  • +
  • -

#4 edjoks  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 16
  • Joined: 17-May 13

Re: Message boxes in C#.net website

Posted 28 May 2013 - 03:16 AM

Itz simple, you cannot without the use of plain javascript or jquery.
Check out 'jqueryui dailogue boxes'.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1