Confirmation with checkbox in gridview
Hi,
I tried posting the same question a few seconds ago but i don't think i succeeded. Sorry if i posted or crossed posted this message.
I have a Gridview with a checkbox that has OnCheckedChanged event. If user clicks the checkbox i want to display a message. But if user clicks cancel on the message i want the checkbox to be unchecked. How can i capture the OK and Cancel buttons from the message?
Thanks
protected void ChkDefEdit_Checked(object sender, EventArgs e)
{
CheckBox chk = sender as CheckBox;
if (chk.Checked==true)
{
string myScript = @"confirm('Default advert code exists for country.\n Sure you want to change default?')";
Page.ClientScript.RegisterStartupScript(this.GetTy pe(), "MyScript", myScript, true);
}
}
<asp:TemplateField HeaderText="Default" Visible="true" >
<EditItemTemplate>
<asp:CheckBox ID="ChkDefEdit" runat="server" Checked='<%# Bind("Default_Code") %>' AutoPostBack="true" OnCheckedChanged ="ChkDefEdit_Checked" />
</EditItemTemplate>
|