Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > I can't dynamically add items to a DataGrid/DataList/Repeater in C#.

Reply
Thread Tools

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

 
 
mmumme@gmail.com
Guest
Posts: n/a
 
      09-02-2005
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?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing Menu Items and Child Menu Items Larry Bud ASP .Net 13 01-07-2008 02:12 PM
Looping through CheckBoxList items doesn't pick up selected ones when items were disabled Bart Van Hemelen ASP .Net 2 09-04-2006 08:35 AM
Dynamically add posted form items into array Daniel Gormley ASP General 1 12-14-2005 06:20 PM
Items in Outbox not moving to Sent Items Ben Lord Computer Support 0 10-23-2003 08:47 AM
grouping items among a list according to items subtag value Gilles Kuhn XML 0 09-15-2003 12:01 PM



Advertisments