donot know check box CheckedChanged event on gridview

Last post 06-15-2008 9:53 PM by winzone. 4 replies.

Sort Posts:

  • donot know check box CheckedChanged event on gridview

    06-09-2008, 11:47 PM
    • Loading...
    • winzone
    • Joined on 01-18-2006, 11:44 PM
    • Sg
    • Posts 44

    First i used checkbox on  grid view with DataSourceID object and read from webservice.

    But now i change to call web service from onPageLoad using :
            DataSet dsMembers = new DataSet();
            SDBWS.Reception chk = new SDBWS.Reception();       
            dsMembers = chk.Get_ChkAccount(string code)

     But the checkbox onCheckedChanged event not work.

     I want to know how to get checkbox OnCheckedChange event when user  click.
     

    asp:GridView ID="gv_Queue" runat=server Width="100%" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" DataSourceID="ObjectDataSource1" AllowPaging="True">
    <Columns><asp:BoundField DataField="QUEUE_NO" HeaderText="Queue No" >

     <ajax:TemplateField>
         <ItemTemplate>
             <asp:CheckBox ID="chkPAccess" runat=server Checked="<%# Bind('PAccess') %>" OnCheckedChanged="chkPAccess_CheckedChanged" />
             <asp:HiddenField ID="hf_CustomerID" runat=server Value="<%# Bind('CUSTOMER_ID') %>" />
         </ItemTemplate>
         <ItemStyle Width="25px" />
    </ajax:TemplateField>


     

    WinZone
  • Re: donot know check box CheckedChanged event on gridview

    06-10-2008, 12:25 AM

    Hi winzone,

    Go thru this URL. It will show that how to raise the events for CheckBox inside the DataGrid.

    http://www.codeproject.com/KB/webforms/datagridcheckbox.aspx

     

    Hope this helps.

    Click Mark as Answer if this post helped u

  • Re: donot know check box CheckedChanged event on gridview

    06-10-2008, 1:53 AM
    • Loading...
    • winzone
    • Joined on 01-18-2006, 11:44 PM
    • Sg
    • Posts 44

     Hi mohamed,

    thank for replying. 

    I mean is not this case. I use asp.net 2.0 GridView with C# and first i call from web service using asp:ObjectDataSource from design view and make OnCheckedChange event on check box.

    At that time, program know when i click checkbox and go to OnCheckedChange event .

    But, now i change to call GridView from code behind Page_Load() using ....

    DataSet dsMembers = new DataSet();
    SDBWS.Reception chk = new SDBWS.Reception();
    dsMembers = chk.Get_ChkAccount(string code)

    gv_Queue.DataSource = dsMembers;
    gv_Queue.DataBind();


    Program don't know OnCheckedChange event when i click check box.

    So, how to make checkbox OnCheckedChange event to know the program.

     

     

    WinZone
  • Re: donot know check box CheckedChanged event on gridview

    06-12-2008, 5:21 AM
    Answer

    Hi,

    The CheckBox's AutoPostBack is false by default. To fire CheckBox's CheckedChanged event, we need to set it to true.

    For example:

    <asp:CheckBox ID="chkPAccess" AutoPostBack="true" runat=server Checked="<%# Bind('PAccess') %>" OnCheckedChanged="chkPAccess_CheckedChanged" />

     

    I hope this helps.

     

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: donot know check box CheckedChanged event on gridview

    06-15-2008, 9:53 PM
    • Loading...
    • winzone
    • Joined on 01-18-2006, 11:44 PM
    • Sg
    • Posts 44

     Thank Thomas Sun,

     I miss this fact to put in the checkbox.
     

    WinZone
Page 1 of 1 (5 items)
Microsoft Communities
Page view counter