How do I loop through checkboxes and set them as Checked?

Discussion in 'ASP .Net Datagrid Control' started by Paul D. Fox, May 9, 2005.

  1. Paul D. Fox

    Paul D. Fox Guest

    I have a Datagrid where there is a Checkbox in the Header. When the user
    clicks on this checkbox, I want all the checkboxes in each row to show as
    Checked. How do I interate through each one and set it to 'Checked' ?

    Paul
     
    Paul D. Fox, May 9, 2005
    #1
    1. Advertising

  2. Paul D. Fox

    Paul D. Fox Guest

    I figured it out.... I'm doing it Server-Side.

    Dim blnCheckBoxChecked As Boolean = False
    btnSubmit.Enabled = False

    Dim i As DataGridItem
    For Each i In dgTimesheet_Master.Items
    Dim deleteChkBxItem As CheckBox =
    CType(i.FindControl("chkSelectedCheckBox"), CheckBox)
    If deleteChkBxItem.Checked = True Then
    blnCheckBoxChecked = True
    End If
    Next i

    btnSubmit.Enabled = blnCheckBoxChecked '(True or False)



    "Eliyahu Goldin" <> wrote in message
    news:...
    > Client side or server side?
    >
    > Eliyahu
    >
    > "Paul D. Fox" <> wrote in message
    > news:...
    >> I have a Datagrid where there is a Checkbox in the Header. When the user
    >> clicks on this checkbox, I want all the checkboxes in each row to show as
    >> Checked. How do I interate through each one and set it to 'Checked' ?
    >>
    >> Paul
    >>
    >>

    >
    >
     
    Paul D. Fox, May 9, 2005
    #2
    1. Advertising

  3. Client side or server side?

    Eliyahu

    "Paul D. Fox" <> wrote in message
    news:...
    > I have a Datagrid where there is a Checkbox in the Header. When the user
    > clicks on this checkbox, I want all the checkboxes in each row to show as
    > Checked. How do I interate through each one and set it to 'Checked' ?
    >
    > Paul
    >
    >
     
    Eliyahu Goldin, May 9, 2005
    #3
  4. So how will it be reflected into the ASP.NET Pages.
    I had a similar problem. But the code snippet provided to me did not work.

    Regards,
    Yogesh

    "Paul D. Fox" <> wrote in message
    news:...
    > I figured it out.... I'm doing it Server-Side.
    >
    > Dim blnCheckBoxChecked As Boolean = False
    > btnSubmit.Enabled = False
    >
    > Dim i As DataGridItem
    > For Each i In dgTimesheet_Master.Items
    > Dim deleteChkBxItem As CheckBox =
    > CType(i.FindControl("chkSelectedCheckBox"), CheckBox)
    > If deleteChkBxItem.Checked = True Then
    > blnCheckBoxChecked = True
    > End If
    > Next i
    >
    > btnSubmit.Enabled = blnCheckBoxChecked '(True or False)
    >
    >
    >
    > "Eliyahu Goldin" <> wrote in message
    > news:...
    > > Client side or server side?
    > >
    > > Eliyahu
    > >
    > > "Paul D. Fox" <> wrote in message
    > > news:...
    > >> I have a Datagrid where there is a Checkbox in the Header. When the

    user
    > >> clicks on this checkbox, I want all the checkboxes in each row to show

    as
    > >> Checked. How do I interate through each one and set it to 'Checked' ?
    > >>
    > >> Paul
    > >>
    > >>

    > >
    > >

    >
    >
     
    Yogesh Kadalgikar, Jun 8, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. yurps
    Replies:
    1
    Views:
    6,930
    rajeshthangarasu1983
    Feb 29, 2008
  2. Paul D. Fox
    Replies:
    6
    Views:
    19,076
    =?Utf-8?B?bWlrZQ==?=
    May 22, 2005
  3. Tim Zych
    Replies:
    2
    Views:
    182
    Tim Zych
    Nov 28, 2005
  4. Replies:
    0
    Views:
    161
  5. Isaac Won
    Replies:
    9
    Views:
    398
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page