I can't dynamically add items to a DataGrid/DataList/Repeater in C#.

Discussion in 'ASP .Net Web Controls' started by mmumme@gmail.com, Sep 2, 2005.

  1. Guest

    Here is what I am trying to do. I have a web page with a bunch of
    ListBoxes. When a user clicks on a ListItem in any one of these
    ListBoxes I want to add info from that ListItem into a
    datagrid/datalist/repeater. In the same row I want to add a dropdown
    box and a couple other columns. So basically I want each row to
    consist of the following columns:

    Text, TextBox, TextBox, DropDown

    First, which is better to use for this - a repeater, a datagrid, or a
    datalist?

    Second, how can I add this dynamically?

    I have tried this simple example just to see if I could add anything to
    the repeater dynamically:

    ArrayList values = new ArrayList();

    values.Add(lstItem.Text);
    values.Add(lstItem.Value);

    rptSelections.DataSource = values;
    rptSelections.DataBind();

    After the databind I see the item in the repeater but it doesn't show
    on the page. I can't get it to display even though it seems to be
    there. Any idea why?

    I've been working .Net for about a year but haven't worked with these
    controls. Any help you could provide would be greatly appreciated!
    Also, are there any good books that cover the above three controls
    really well?
     
    , Sep 2, 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. Nevyn Twyll
    Replies:
    8
    Views:
    1,939
  2. Alan Silver
    Replies:
    1
    Views:
    4,680
    Alan Silver
    Jul 6, 2005
  3. Alan Silver
    Replies:
    4
    Views:
    10,525
    Alan Silver
    Aug 4, 2005
  4. Replies:
    4
    Views:
    9,979
  5. Henrik
    Replies:
    1
    Views:
    448
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
Loading...

Share This Page