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

M

mmumme

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top