473,329 Members | 1,214 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,329 software developers and data experts.

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 1288
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.