473,732 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4567
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 programmaticall y to a DataGrid?

Thanks.

Mike
"Ignacio Machin" <ignacio.machin _AT_dot.state.f l.us> wrote in message news:%2******** *******@TK2MSFT NGP11.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 programmaticall y 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********@nos pam.com> wrote in message
news:eE******** ******@tk2msftn gp13.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
9116
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 Record (which is not neccesarily a database record..) but it'll be shown up as an ordinary item in the datalist rendered as an Item or AlternatingItem ... Is there a way to do this? Thanks
0
1216
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 GetData function. the extra rows were filled with my column header.for example, If I have my field=5, the first row is my original data, the rest are filled as my header name. I have check to work flow. it shouldn't filled that header name. I...
3
1950
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 example would be: Let's say Column1=StartDate and Column2=EndDate. In addition to displaying Column1 and Column2, I need to do some calculations and display in as Column3. The calculations are easy and can be done in the code-behind. How to display...
1
5290
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 the user doesn't have to scroll horizontally. Essentially, I want to wrap a datagrid row (not text in individual columns) with as much control as possible. Make sense? While this seems simple enough on the surface, I can't figure out how to do...
3
6264
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 adding the style definition below in the <hr> tag (line tag) which was the last item in the page before the break: <hr color="gray" size="1" style="PAGE-BREAK-AFTER: always"> and when the form is printed it forces a page-break. However, now I'm...
3
6429
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 it even possible to do with a datalist or shud i use only a datagrid... any ideas or online samples/URLS would be greatly appreicated ... thanks for ur time Ben
2
2002
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 each record is a new line. Using ItemTemplate and AlternateItemTemplate I could display two columns but I need another one. How can I display records on columns instead of rows using the repeater control? TIA,
0
905
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 datatable. Can anyone point me into some direction? Thank you Schapopa
3
3150
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 expects a DataGridColumn so I instantiated an object of type TemplateColumn that I had hoped I could add a CheckBox to. I soon discovered that the ItemTemplate property of the TemplateColumn class returned an object that had implemented the...
0
8773
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9445
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9306
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9234
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9180
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6733
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.