Access selected items' (ListItems) VALUES of dynamically generated CheckBoxList on postBack

Discussion in 'ASP .Net Web Controls' started by Amelyan, Apr 17, 2005.

  1. Amelyan

    Amelyan Guest

    When I dynamically create CheckButtonList, I add ListItem(s) to my
    CheckButtonList object chkList

    chkList.Items.Add(new ListItem("My Text", "My Value"));

    The resulting HTML doesn't contain value="My Value". Therefore, I can't
    access "My Value" with Request.Form on post back.

    I do get the desired outcome with my RadioButtonList object radioList when I
    do
    radioList.Items.Add(new ListItem("My Text", "My Value"));
    because for RadioButtonList, I get "My Value" in html.

    How can I make it work for CheckBoxList? What I am trying to achive is to
    get the values associated with checked items of my dynamically generated
    CheckBoxList through Request.Form. I could do it with RradioButtonList but
    not with CheckBoxList. I don't want to have to persist my dynamically
    generated CheckBoxList into Session.

    Thank you,
    -Bob
    Amelyan, Apr 17, 2005
    #1
    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. Eric Robishaw
    Replies:
    1
    Views:
    4,340
    Victor Garcia Aprea [MVP]
    Dec 27, 2003
  2. Boris
    Replies:
    1
    Views:
    2,916
    binusworld
    Sep 30, 2008
  3. Patrick.O.Ige
    Replies:
    5
    Views:
    19,104
    Patrick.O.Ige
    Jun 19, 2005
  4. Bart Van Hemelen
    Replies:
    2
    Views:
    4,667
    Bart Van Hemelen
    Sep 4, 2006
  5. Replies:
    4
    Views:
    2,653
Loading...

Share This Page