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

dynamic html table with textboxes

Environment: VS.NET 2003
Application: ASP.NET web application
Program language: C# (Csharp)

Situation:
I get some information from a sql database. With this information I generate
a html table "myHtmlTable" dynamically. For each data row I added an
additional column. In the additional column is a textbox called
"textbox(rowcount)". In my webpage (.aspx) I have a PlaceHolder (myPH). The
generated html table is added to this PlaceHolder:
myPH.Controls.Add(myHtmlTable);

Now I have a problem. If the user enter some text in the textbox and click
the submit button, the PlaceHolder is emty! Also the user input is lost. My
solution is to generate the html table with each request in the form_load
method. Then, the textbox and the entered text are available. But this is a
very bad solution.

Does anyone know a better way for handling that?

Thanks in advance.

Michael

Nov 18 '05 #1
2 3259
I think that you have two options:

1. Regenerate the table, so that the values are populated (this is by
design of Asp.Net).

2. Maybe you are giving the textboxes unique IDs, so you could get teh
user values from the Page.Request.Form name-value collection, with
something like:

foreach (string key in Page.Request.Form.Keys)
{
string val = Page.Request.Form[key];
}

HTH,

Chad Evans
Michael Meckelein wrote:
Environment: VS.NET 2003
Application: ASP.NET web application
Program language: C# (Csharp)

Situation:
I get some information from a sql database. With this information I generate
a html table "myHtmlTable" dynamically. For each data row I added an
additional column. In the additional column is a textbox called
"textbox(rowcount)". In my webpage (.aspx) I have a PlaceHolder (myPH). The
generated html table is added to this PlaceHolder:
myPH.Controls.Add(myHtmlTable);

Now I have a problem. If the user enter some text in the textbox and click
the submit button, the PlaceHolder is emty! Also the user input is lost. My
solution is to generate the html table with each request in the form_load
method. Then, the textbox and the entered text are available. But this is a
very bad solution.

Does anyone know a better way for handling that?

Thanks in advance.

Michael

Nov 18 '05 #2

"chad [email at] gosigma.com" <"chad [email at] gosigma.com"> wrote in
message
I think that you have two options:

1. Regenerate the table, so that the values are populated (this is by
design of Asp.Net).
This is what I currently do.
2. Maybe you are giving the textboxes unique IDs, so you could get teh
user values from the Page.Request.Form name-value collection, with
something like:

foreach (string key in Page.Request.Form.Keys)
{
string val = Page.Request.Form[key];
}

This looks like a good idea. I will try it, thx

Michael

Nov 18 '05 #3

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

Similar topics

3
by: David Whitney | last post by:
All: I have a control that renders a table. As the table is rendered, each row in the table is constructed by creating a run-time (dynamic) object that is derived from an HtmlTableRow. The row...
1
by: Carlos Gomez | last post by:
I used to develop with Classic ASP. Now I'm learning ASP.NET I used to create tables 'on-the-fly' using recordsets. My code would loop through the recorset.Fields to make the headers. If I added...
2
by: Michael Meckelein | last post by:
Environment: VS.NET 2003 Application: ASP.NET web application Program language: C# (Csharp) Situation: I get some information from a sql database. With this information I generate a html table...
4
by: Bhavin | last post by:
How can I capture user entered values from dynamically created controls in ASP.NET ? Thanks,
6
by: dhnriverside | last post by:
Hi peeps, I'm trying to create some controls textboxes at runtime, based on the number of items in a IETreeView that are checked. That I can do, I've got a place holder and I can create the...
15
by: Kapil Jain | last post by:
Dear All, What i need to achieve is : I am generating dynamic text boxes thru dhtml coding, i need onChange event of oragnistation text box i.e dynamically generated on click of "More" button in...
8
by: stephen.clancy | last post by:
I have created a Table on the fly with embedded textboxes. I need to update a database based on the input to these textboxes. What's the best approach? Sample of setup; Table table = new...
0
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all...
20
by: daitasri | last post by:
Hi I am using HTML and JS only. When i click on Button(say Add) a new row will be added in to the table with dropdown's and textboxes.I want to know how to access the data entered in the...
2
by: englishman69 | last post by:
Hello, I have been banging my head against this one for a while... Searches online have revealed many different proposals for correcting my issue but none that I can follow! My basic situation...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.