473,395 Members | 1,649 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,395 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 2188
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...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.