473,473 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Add a new row dynamically to a table

Hello,

I have created a dynamic webcontrol table with several rows. I also have a
ImageButton which
adds a new row to the table. After I have added a new row, and I click the
ImageButton again
I get: "Multiple controls with id '_ctl0' was found ..."

This is what I have done:

page_init:

Check if the table is persisted in a Session variable, if it is then
add it to a placeholder control.

page_load:

If not postback then get the data and render the table and save it
to a Session variable. The Session variable is used in the page_init method
to re-create the dynamic table

I always initialize the imagebutton and adds the eventhandler for the
ImageBtton_onClick.

The error message appers after the page_init method has executed.

I don´t set any ID on the controls in the cells or rows. I let ASP.NET
handle that for me.

Can someone give me any pointers or hints what might be wrong ?

Regards,

// Henke
Nov 18 '05 #1
1 1291
Jos
Henke wrote:
Hello,

I have created a dynamic webcontrol table with several rows. I also
have a ImageButton which
adds a new row to the table. After I have added a new row, and I
click the ImageButton again
I get: "Multiple controls with id '_ctl0' was found ..."

This is what I have done:

page_init:

Check if the table is persisted in a Session variable, if it is then
add it to a placeholder control.

page_load:

If not postback then get the data and render the table and save it
to a Session variable. The Session variable is used in the page_init
method to re-create the dynamic table

I always initialize the imagebutton and adds the eventhandler for the
ImageBtton_onClick.

The error message appers after the page_init method has executed.

I don´t set any ID on the controls in the cells or rows. I let ASP.NET
handle that for me.

Can someone give me any pointers or hints what might be wrong ?

Regards,

// Henke


I guess the error is caused by the recreation from Session.
As a general rule, you should not use Session to persist your table, but
Viewstate.

--

Jos
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: john_williams_800 | last post by:
Hi; I am just starting to use the DOM to do some more advanced javascripting so please be patient with my question if it is an ignorant question. I would like to use the DOM to dynamically...
3
by: Kiyomi | last post by:
Hello, I create a Table1 dynamically at run time, and at the same time, I would like to create LinkButton controls, also dynamically, and insert them into each line in my Table1. I would...
0
by: Diane Yocom | last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but... I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where...
2
by: buran | last post by:
Dear ASP.NET Programmers, I have a HTML table (running as server control with the control ID: tblInsertSP). The table has 16 rows with textboxes. Depending on the value of the ddlSPType, which...
2
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to...
2
by: grawsha2000 | last post by:
Hello, How can I add a table to asp.net page dynamically with Code Behind style. I still can't find a way of doing it. This really causes me a big problem when I deal with records from...
1
by: vj | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file? I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
0
by: vijendra | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file?I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
1
by: semomaniz | last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have...
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
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,...
1
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.