473,804 Members | 3,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "myHtmlTabl e" dynamically. For each data row I added an
additional column. In the additional column is a textbox called
"textbox(rowcou nt)". In my webpage (.aspx) I have a PlaceHolder (myPH). The
generated html table is added to this PlaceHolder:
myPH.Controls.A dd(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 2214
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.Fo rm name-value collection, with
something like:

foreach (string key in Page.Request.Fo rm.Keys)
{
string val = Page.Request.Fo rm[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 "myHtmlTabl e" dynamically. For each data row I added an
additional column. In the additional column is a textbox called
"textbox(rowcou nt)". In my webpage (.aspx) I have a PlaceHolder (myPH). The
generated html table is added to this PlaceHolder:
myPH.Controls.A dd(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.Fo rm name-value collection, with
something like:

foreach (string key in Page.Request.Fo rm.Keys)
{
string val = Page.Request.Fo rm[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
3040
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 has three HtmlTableCell objects, and each cell contains a single control added to the HtmlTableCell's Controls collection. The basic table renders correctly, but the controls within the HtmlTableCell objects do not; the cells are just empty. (Just...
1
2509
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 a field to the table, I didn't have to update my code. I liked the fact that I could test for a field.name to customize a column title if I wanted to. Same goes for the rows, I often inserted something in the cells of certain columns (textboxes,...
2
3273
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 "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:
4
1909
by: Bhavin | last post by:
How can I capture user entered values from dynamically created controls in ASP.NET ? Thanks,
6
2240
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 corrent number of controls. The problem is that they appear next to each other. I want to create the controls with some wording to the left of them (again, dynamically generated). Normally id use <table> with two colums, one for the
8
13355
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 Table(); table.CellPadding = 5; table.ID = "Results"; cell = new TableCell();
0
5296
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 the days in the week with dates and textboxes to fill in some data. row 1: question
20
3926
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 textboxes and dropdowns Please help me out as i am a beginner
2
5038
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 is this, I have a page which uses multiple postbacks to generate a list of dynamic text boxes with appropriate labels. However, when I do the final postback to enter the values in the dynamic textboxes into the database the values seem to become...
0
9584
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
10337
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...
0
10082
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
9160
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
7622
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
5525
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...
0
5654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.