ASP.NET - i need OK and Cancel message box in the Asp .net how to get this please help me

Asked By Lata on 03-Jul-12 06:59 AM

    when deleting the value from gridview using link button i need pop message wid ok and cance if i presses cancel skip from delete or if k it ll delete the record what is the code for this?
KCH replied to Lata on 03-Jul-12 07:30 AM
Hi Lata,
Try this code...

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
   if (e.Row.RowType == DataControlRowType.DataRow)
     LinkButton lnkbtn = (LinkButton)e.Row.Cells[0].Controls[0];
    lnkbtn.Attributes.Add("onclick","return confirm('Are you going to delete it surely???');");

bharti odedra replied to Lata on 03-Jul-12 07:46 AM
try this way

Displays a message in a dialog box, waits for the user to click a button, and then returns an integer indicating which button the user clicked.

Public Function MsgBox( _
ByVal Prompt As Object, _
Optional ByVal Buttons As MsgBoxStyle = MsgBoxStyle.OKOnly, _
Optional ByVal Title As Object = Nothing _
) As MsgBoxResult
Required. String expression displayed as the message in the dialog box. The maximum length of Prompt is approximately 1024 characters, depending on the width of the characters used. If Prompt consists of more than one line, you can separate the lines using a carriage return character (Chr(13)), a linefeed character (Chr(10)), or a carriage return/linefeed character combination (Chr(13) & Chr(10)) between each line. 
Optional. Numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality of the message box. If you omit Buttons, the default value is zero. 
Optional. String expression displayed in the title bar of the dialog box. If you omit Title, the application name is placed in the title bar. 

Return Values
Constant Value 
OK 1 
Cancel 2 
Abort 3 
Retry 4 
Ignore 5 
Yes 6 
No 7 

Jitendra Faye replied to Lata on 04-Jul-12 12:32 AM
Refer this link-

here you will get my article-

Try this and let me know;