Hoe to get DataList Checkbox status in item template

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Hoe to get DataList Checkbox status in item template

    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 Guest

  2. Similar Questions and Discussions

    1. Adding another item to a completed DataLIst
      Hello, I'm using a datalist, 2 columns, verticle direction. When the items are finished being displayed, I'd like to "manually" add addition text...
    2. checkbox in datalist
      I have a datalist that show quantity price and some information in each row when user click oon checkbox it show in quantity 1 and calculate the...
    3. Evaluating a datalist item using a function
      As I read in the records from the SQL into my datalist I want to be able to check if the value is not blank, and if itsn't blank I want to append...
    4. Programmatically Adding An Item To The DataList
      Hi all, I've a DataList control and it's DataBound by a SqlDataReader... The Reader returns say 3 records and as expected the datalist shows 3...
    5. DataList item not binding.
      Hi, I have a Datalist inside the ItemTemplate of another DataList. When I drilldown, I'm not getting any data in either the itemtemplate or...
  3. #2

    Default Re: Hoe to get DataList Checkbox status in item template

    Hi...

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

    "Vannela" <anonymous@discussions.microsoft.com> wrote in message
    news:00b901c3c395$cb22ba20$a001280a@phx.gbl...
    > 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 Guest

  4. #3

    Default Re: Hoe to get DataList Checkbox status in item template


    How do i do this in VB?


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Paul X Guest

  5. #4

    Default Re: Hoe to get DataList Checkbox status in item template

    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" <sni_ker@hotmail.com> wrote in message
    news:uBEdOPDxDHA.2460@TK2MSFTNGP10.phx.gbl...
    >
    > How do i do this in VB?
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Eugene Jenihov Guest

  6. #5

    Default 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" <anonymous@discussions.microsoft.com> wrote in
    message
    >news:00b901c3c395$cb22ba20$a001280a@phx.gbl...
    >> 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 Guest

  7. #6

    Thumbs up null reference

    Hey vannela, r u changing the name of datalist from MyDataList to that of your own data-list name..??
    And in FindControl() method too, pass your own ckeck-box name...
    Unregistered Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139