471,122 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

Adding rows to a datalist

I take it that the only way to add rows to a DataList control is through DataBind?

If not, how do I manually add rows to a DataList control? I have searched everywhere and can't find an example anywhere other than
through building a DataTable, and then doing a DataBind.

Thanks.

Mike
Nov 15 '05 #1
1 3869
Thanks, that's what I thought.

In your coding, how do you decide between using a DataList vs. a DataGrid? And, can you add rows programmatically to a DataGrid?

Thanks.

Mike
"Ignacio Machin" <ignacio.machin_AT_dot.state.fl.us> wrote in message news:%2***************@TK2MSFTNGP11.phx.gbl...
Hi Mike,

I'm afraid that you cannot.

From MSDN description of DataList class:
Use the DataList control to display a template-defined data bound list. The
DataList control supports selecting and editing.

So it needs to be databounded.

From MSDN's description of Items property:
Use the Items collection to programmatically control the items in the
DataList control. The Items collection does not provide any methods to add
or remove items to the collection. However, you can control the contents of
an item by providing a handler for the ItemCreated event.

Note Only items bound to the data source are contained in the Items
collection. The header, footer, and separator are not included in the
collection.

So you cannot add to the Items collection

--
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Mike Malter" <mi********@nospam.com> wrote in message
news:eE**************@tk2msftngp13.phx.gbl...
I take it that the only way to add rows to a DataList control is through

DataBind?

If not, how do I manually add rows to a DataList control? I have searched

everywhere and can't find an example anywhere other than
through building a DataTable, and then doing a DataBind.

Thanks.

Mike


Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by pei_world | last post: by
1 post views Thread by Craig Banks | last post: by
3 posts views Thread by anon | last post: by
2 posts views Thread by Erik Cruz | last post: by
reply views Thread by schapopa | last post: by
3 posts views Thread by Fao, Sean | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.