ListItemCollection[index].Selected property not updating

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

  1. #1

    Default ListItemCollection[index].Selected property not updating

    Thanks in advance to anyone who can help :)

    I have a custom control that includesa ListItemCollection property that
    allows clients using it to dynamically add/remove/etc items just as you would
    a normal ListBox.

    However, my control uses the HtmlTextWriter to render an html <select> which
    adds the ListItemCollection Items into it manually in the "RenderContents"
    method.

    When debugging the control, I'll add an item to the <select> element via the
    NumberListCollection.Add property. After selecting one of the items and
    having the list checked to see what was selected, it does not recognize it.

    Should I be doing someting with the "selected" attribute of the select
    element? I don't wanna use a ListBox server control either..
    studen771 Guest

  2. Similar Questions and Discussions

    1. tabnavigator determine selected index
      I am having some trouble with a datagrid inside a tabnavigator. I have tabs that can be added dynamically. What I am trying to do is a search...
    2. Strange behavior when setting gridview selected index
      Hello there, I have an asp.net 2.0 web app that uses gridview and formview. When a user selects an item in the gridview the formview appears to...
    3. .Selected property for listbox does not work
      Hi I have written a code for showing the list boxes as selected using a Listitem and the selected property of the items. Now I have 2 list boxes...
    4. Needed: Index to a selected DataView row
      Hi, I've got a DataGrid bound to a DataView that is sorted. ("Aha!", I hear you saying.) When I go to EditMode I get the right DataRow, but I...
    5. Drop down list selected index
      I am populating a drop down list with a privilege levels from a table called "Privilege" with the fields "PrivilegeID" and "PrivilegeName". In a...
  3. #2

    Default Re: ListItemCollection[index].Selected property not updating

    > When debugging the control, I'll add an item to the <select> element via
    > the
    > NumberListCollection.Add property. After selecting one of the items and
    > having the list checked to see what was selected, it does not recognize
    > it.
    What's the key against which you are trying to get the data?
    What do you mean when you say "it does not recognize it"?
    Who is first "it"? What is the second "it"? How are you retrieving the data?
    > Should I be doing someting with the "selected" attribute of the select
    > element? I don't wanna use a ListBox server control either..
    Do you have a 'name' attribute to the 'selected' element?

    Just curious... the reason behind not using ListBox? You are anyway
    duplicating the functionality... or as I generally say, "Reinventing the
    wheel" once again!


    --
    Happy Hacking,
    Gaurav Vaish | [url]www.mastergaurav.com[/url]
    [url]www.edujinionline.com[/url]
    [url]http://articles.edujinionline.com/webservices[/url]
    -----------------------------------------


    Gaurav Vaish \(www.EdujiniOnline.com\) 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