datagrid controls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hkarthik
    New Member
    • Jan 2007
    • 34

    datagrid controls

    hi,

    In my datagrid i have added the checkbox controls. Ihave done this with the help of "Template column". So now it creates as many check boxes depending upon the data's in my database. Now what i have done is , i have used a checkbox outside my datagrid. When i click this checkbox ie.. when this "checkbox.check ed=true" then the checkboxes inside my datagrid should also be checked. I tried but could not find a solution.

    I tried it this way

    "" Dim dgitem As DataGridItem
    Dim chkSelected As CheckBox

    For Each dgitem In DataGrid1.Items
    chkSelected = dgitem.FindCont rol("chkName")
    If CheckBox1.Check ed = True Then
    chkSelected.Che cked = True

    End If

    Next ""


    while doing this ie when i check the checkbox outside the datagrid the check boxes inside ny datagrid is not getting enabled(checked ).

    help me to get a solution for this
  • radcaesar
    Recognized Expert Contributor
    • Sep 2006
    • 759

    #2
    http://www.devx.com/tips/Tip/20238

    Originally posted by hkarthik
    hi,

    In my datagrid i have added the checkbox controls. Ihave done this with the help of "Template column". So now it creates as many check boxes depending upon the data's in my database. Now what i have done is , i have used a checkbox outside my datagrid. When i click this checkbox ie.. when this "checkbox.check ed=true" then the checkboxes inside my datagrid should also be checked. I tried but could not find a solution.

    I tried it this way

    "" Dim dgitem As DataGridItem
    Dim chkSelected As CheckBox

    For Each dgitem In DataGrid1.Items
    chkSelected = dgitem.FindCont rol("chkName")
    If CheckBox1.Check ed = True Then
    chkSelected.Che cked = True

    End If

    Next ""


    while doing this ie when i check the checkbox outside the datagrid the check boxes inside ny datagrid is not getting enabled(checked ).

    help me to get a solution for this

    Comment

    • ashasprabhu
      New Member
      • Jan 2007
      • 52

      #3
      check this although its for grid view just see how it is used
      http://aspnet.4guysfro mrolla.com/articles/052406-1.aspx

      Comment

      • enreil
        New Member
        • Jan 2007
        • 86

        #4
        Have you enabled postback on your checkbox outside the datagrid? Once you do that, make sure the code you posted is enclosed in that checkbox's checked_changed event. You should also make sure you cast your control to the CheckBox type. Try the following in the checked_changed event:

        Dim dgitem As DataGridItem
        Dim chkSelected As CheckBox

        For Each dgitem In DataGrid1.Items
        chkSelected = CType(dgitem.Fi ndControl("chkN ame"), CheckBox)
        chkSelected = CheckBox1.Check ed
        Next

        Originally posted by hkarthik
        hi,

        In my datagrid i have added the checkbox controls. Ihave done this with the help of "Template column". So now it creates as many check boxes depending upon the data's in my database. Now what i have done is , i have used a checkbox outside my datagrid. When i click this checkbox ie.. when this "checkbox.check ed=true" then the checkboxes inside my datagrid should also be checked. I tried but could not find a solution.

        I tried it this way

        "" Dim dgitem As DataGridItem
        Dim chkSelected As CheckBox

        For Each dgitem In DataGrid1.Items
        chkSelected = dgitem.FindCont rol("chkName")
        If CheckBox1.Check ed = True Then
        chkSelected.Che cked = True

        End If

        Next ""


        while doing this ie when i check the checkbox outside the datagrid the check boxes inside ny datagrid is not getting enabled(checked ).

        help me to get a solution for this

        Comment

        Working...