CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Jul 2006
    Posts
    141

    A single check box to check/uncheck all checkbox in a datagrid view

    Hi,
    I am a new bee in ASP.NEt.
    My coding is as below.I have a problem in checking whether the first checkbox is checked or unchecked and then check /unchecked all the other checkbox in the datagridview.

    Code:
    <script runat="server">
    
        Sub CheckAll_Click(sender As Object, e As EventArgs)
            Dim i As Integer
            
            For i = 0 To dgv1.Rows.Count - 1
                
                CType(dgv1.Rows(i).FindControl("chkAll"), CheckBox).Checked = True
            Next
            
            
        End Sub
    
    </script>
    
    
     <HeaderTemplate>								
                                <asp:CheckBox id="chkAllq" runat="server" OnCheckedChanged="CheckAll_Click" >
                                </asp:CheckBox>							
                                </HeaderTemplate>
    My problem is how to fire the CheckAll_Click event when the checkbox is checked or unchecked.Does any one has idea on this?what should i put in instead of OnCheckedChanged as does not fire the event ?
    Last edited by johnsonlim026; December 25th, 2007 at 11:22 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured