473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 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 4531
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Umut K. | last post by:
Hi all, I've a DataList control and it's DataBound by a SqlDataReader... The Reader returns say 3 records and as expected the datalist shows 3 rows. What i want to do is to add another extra...
0
by: pei_world | last post by:
I am using the following code to configurate my datagrid and load data from my Pocket Access Database. however, I got some more row extra, and it is the number I setted with my object array in my...
3
by: Robin Thomas | last post by:
I am fairly new to ASP.NET so I think I am missing something fundamental. Anyway, quite often I am pulling data from a database, but then I need to use that data to produce more data. A simple...
1
by: Craig Banks | last post by:
If a row of data in a dataset has a lot of columns the row displaying the data in a datagrid will run way off the screen. What I'd like to do is display a row of data over several datagrid rows so...
3
by: Barbara Alderton | last post by:
I recently wrote an ASP.NET app that used user controls. I produced a printer-friendly output form. One requirement was a pagebreak between one part of the form and another. I had no problem...
3
by: anon | last post by:
Hi All, I would like to make a datalist which takes new information by allowing users(with some button or link) to add new rows to a datalist with some information and save the information.....is...
2
by: Erik Cruz | last post by:
Hi. I have a repeater control bound to an ArrayList. When displaying the data, I need to show 3 columns per row, each column being one entry of my ArrayList, but the repeater understands that...
0
by: schapopa | last post by:
Hi, I want to make some rows in datalist red, based on the resut of the query. e.g. my datalist has 10 rows, now I want to have row 3,4,7 in red because of value = true for row 3,4 and 7 in...
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.