msgbox

liunx

Guest
hello, would anybody like to inform me of how to make a message box wth simple ok and cancel buttons, so that is cancel is pressed, it doesnt run the code? thanksto do that you must use JavaScript, can you tell me where do you want to do that?! i mean in DataGrid Button or normal button!!well it wont different much actualy :) , here's how to do it
first you need a JS function and you can place it anywhere, Body or Head

function confirmDelete() {
return window.confirm("are you sure?");
}

in Page_Load function:

Button1.Attributes.Add("OnClick", "return confirmDelete()")

if its in DataGrid Item Template

Dim i As Integer
For i = 0 To DataGrid1.Items.Count - 1
Dim Btn as Button = DataGrid1.Item(i).FindControl("Button1")
Btn.Attributes.Add("OnClick", "return confirmDelete()")
Next

Hope it works ;)
 
Back
Top