Hoe to get DataList Checkbox status in item template

Discussion in 'ASP .Net Building Controls' started by Vannela, Dec 16, 2003.

  1. Vannela

    Vannela Guest

    I want to get the status of the checkbox control in the
    item template of the DataList in the code behind

    Using findcontrol i am not able to get the status of the
    checkbox . How shouls i get the status of the checkbox
    whether it is checked or not?\

    Thank you
    Vannela, Dec 16, 2003
    #1
    1. Advertising

  2. Hi...

    foreach(DataListItem item in MyDataList.Items) {
    CheckBox myCheckBox = (CheckBox)item.FindControl("chkMyCheckBox");
    if (myCheckBox.Checked)
    {
    //do some work
    }
    }

    "Vannela" <> wrote in message
    news:00b901c3c395$cb22ba20$...
    > I want to get the status of the checkbox control in the
    > item template of the DataList in the code behind
    >
    > Using findcontrol i am not able to get the status of the
    > checkbox . How shouls i get the status of the checkbox
    > whether it is checked or not?\
    >
    > Thank you
    Eugene Jenihov, Dec 16, 2003
    #2
    1. Advertising

  3. Vannela

    Paul X Guest

    How do i do this in VB?


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Paul X, Dec 17, 2003
    #3
  4. Domething like this...

    Dim item As DataListItem
    Dim myCheckBox As CheckBox
    For Each item In DataList1.Items
    If (CType(item.FindControl("chkMyCheckBox"),
    CheckBox).Checked)
    'Do some work
    End If
    Next item


    "Paul X" <> wrote in message
    news:...
    >
    > How do i do this in VB?
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Eugene Jenihov, Dec 18, 2003
    #4
  5. Vannela

    Vannela Guest

    Re: How to get DataList Checkbox status in item template

    Hi

    I am getting the error as null object reference
    I am no able to get the checkbox of the datalist into the
    my checkbox ie., myCheckBox

    What could be the problem?


    Thank you


    >-----Original Message-----
    >Hi...
    >
    >foreach(DataListItem item in MyDataList.Items) {
    > CheckBox myCheckBox = (CheckBox)item.FindControl

    ("chkMyCheckBox");
    > if (myCheckBox.Checked)
    > {
    > //do some work
    > }
    >}
    >
    >"Vannela" <> wrote in

    message
    >news:00b901c3c395$cb22ba20$...
    >> I want to get the status of the checkbox control in the
    >> item template of the DataList in the code behind
    >>
    >> Using findcontrol i am not able to get the status of the
    >> checkbox . How shouls i get the status of the checkbox
    >> whether it is checked or not?\
    >>
    >> Thank you

    >
    >
    >.
    >
    Vannela, Dec 29, 2003
    #5
    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. Vannela

    DataList checkbox status

    Vannela, Dec 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    6,802
    Claudio Perrone
    Dec 17, 2003
  2. Nevyn Twyll
    Replies:
    8
    Views:
    1,849
  3. VB Programmer
    Replies:
    1
    Views:
    4,403
    Ken Cox [Microsoft MVP]
    Apr 13, 2005
  4. Replies:
    1
    Views:
    444
  5. pluskid
    Replies:
    8
    Views:
    154
    Judson Lester
    Feb 5, 2008
Loading...

Share This Page