Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 24th, 2007, 06:13 AM
Authorized User
 
Join Date: Oct 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Gridview and Checkbox krasnokojiy ASP.NET 2.0 Basics 14 February 28th, 2008 12:56 PM
Checkbox in Gridview yukijocelyn ASP.NET 2.0 Basics 0 September 24th, 2007 12:32 AM
Checkbox in GridView aliirfan84 ASP.NET 2.0 Professional 1 May 15th, 2007 03:59 PM
Gridview checkbox problems pauliehaha ASP.NET 2.0 Professional 1 May 3rd, 2007 04:14 AM
Delete Confirmation From within a Gridview rit01 ASP.NET 2.0 Professional 5 March 8th, 2007 06:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.