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

How do you query the values of textboxes dynamically created in a Panel container??

SD
Hello,

I have a form that has a panel container where I'm adding textboxes
dynamically based on a query to database, so I'm looping through the
records.

The problem I have is that once built, I need to pass those textboxes values
to another for to build the parameters for a report.

Here is the sample:

While myReader.Read()
Dim txtBox As New TextBox
Dim lbLabel As New Label
parCounter = parCounter + 1

' Create dynamic controls here.
lbLabel.ID = "Label" + parCounter.ToString()
lbLabel.Text = myReader("parameter") & " "
lbLabel.Font.Bold = True
lbLabel.Font.Size = FontUnit.Parse(15)

lbLabel.ForeColor = Color.Navy
Page.Controls.Add(lbLabel)
txtBox.ID = "Textbox" + parCounter.ToString()
Page.Controls.Add(txtBox)
Page.Controls.Add(New LiteralControl("<br>"))
End While

Dim objButton As New Button
objButton.Text = " Run Report "
objButton.ID = "ButtonID"
'AddHandler objButton.Click, AddressOf ButtonID_Click
Panel1.Controls.Add(New LiteralControl("<br>"))
Panel1.Controls.Add(objButton)

So now on the postback I need to parse through all these values, but can't
find a single routine to handle this.

Any ideas???

SD
Nov 19 '05 #1
3 1223
Well, if you just need to get the values from the text box, you could do it
old Request.Forms style.

string s = null;
for( int parCounter = 0 ; parCounter == parCounter ; parCounter++ )
{
s = Request.Form["TextBox" + parCounter.ToString()];
if ( s == null ) break; //leaves for loop

//this is a value from the text box.
Response.Write( s );
}

HTH,

bill
"SD" <sd@nospam.net> wrote in message
news:1115297659.b4aef7576e0c3f7bbf7d1eb29005b9ce@t eranews...
Hello,

I have a form that has a panel container where I'm adding textboxes
dynamically based on a query to database, so I'm looping through the
records.

The problem I have is that once built, I need to pass those textboxes values to another for to build the parameters for a report.

Here is the sample:

While myReader.Read()
Dim txtBox As New TextBox
Dim lbLabel As New Label
parCounter = parCounter + 1

' Create dynamic controls here.
lbLabel.ID = "Label" + parCounter.ToString()
lbLabel.Text = myReader("parameter") & " "
lbLabel.Font.Bold = True
lbLabel.Font.Size = FontUnit.Parse(15)

lbLabel.ForeColor = Color.Navy
Page.Controls.Add(lbLabel)
txtBox.ID = "Textbox" + parCounter.ToString()
Page.Controls.Add(txtBox)
Page.Controls.Add(New LiteralControl("<br>"))
End While

Dim objButton As New Button
objButton.Text = " Run Report "
objButton.ID = "ButtonID"
'AddHandler objButton.Click, AddressOf ButtonID_Click
Panel1.Controls.Add(New LiteralControl("<br>"))
Panel1.Controls.Add(objButton)

So now on the postback I need to parse through all these values, but can't
find a single routine to handle this.

Any ideas???

SD

Nov 19 '05 #2
Thanks! Your solution solved my problem and it's the easiest one to follow. I
had been searching for a fix for two days.
Nov 19 '05 #3
Thankyou also, as your answer solved my problem as well.
I have been trying to figure this out and although I have received help from
others nothing has seemed to work.

"William F. Robertson, Jr." wrote:
Well, if you just need to get the values from the text box, you could do it
old Request.Forms style.

string s = null;
for( int parCounter = 0 ; parCounter == parCounter ; parCounter++ )
{
s = Request.Form["TextBox" + parCounter.ToString()];
if ( s == null ) break; //leaves for loop

//this is a value from the text box.
Response.Write( s );
}

HTH,

bill
"SD" <sd@nospam.net> wrote in message
news:1115297659.b4aef7576e0c3f7bbf7d1eb29005b9ce@t eranews...
Hello,

I have a form that has a panel container where I'm adding textboxes
dynamically based on a query to database, so I'm looping through the
records.

The problem I have is that once built, I need to pass those textboxes

values
to another for to build the parameters for a report.

Here is the sample:

While myReader.Read()
Dim txtBox As New TextBox
Dim lbLabel As New Label
parCounter = parCounter + 1

' Create dynamic controls here.
lbLabel.ID = "Label" + parCounter.ToString()
lbLabel.Text = myReader("parameter") & " "
lbLabel.Font.Bold = True
lbLabel.Font.Size = FontUnit.Parse(15)

lbLabel.ForeColor = Color.Navy
Page.Controls.Add(lbLabel)
txtBox.ID = "Textbox" + parCounter.ToString()
Page.Controls.Add(txtBox)
Page.Controls.Add(New LiteralControl("<br>"))
End While

Dim objButton As New Button
objButton.Text = " Run Report "
objButton.ID = "ButtonID"
'AddHandler objButton.Click, AddressOf ButtonID_Click
Panel1.Controls.Add(New LiteralControl("<br>"))
Panel1.Controls.Add(objButton)

So now on the postback I need to parse through all these values, but can't
find a single routine to handle this.

Any ideas???

SD


Nov 19 '05 #4

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

Similar topics

3
by: Forconi Boris via .NET 247 | last post by:
Hi, I'm working on a project in witch I have to list data(products that can be selected with a certain quantity) from anXML document, with key words entered by the user. A Table isdynamically created...
4
by: Mark Broadbent | last post by:
This one has got me absolutely stumped. At work I have created a simple web form that gets data from a sql backend and puts this to a dataset. I have an edit button that when clicked will set...
5
by: \A_Michigan_User\ | last post by:
I'm using asp.net/vb.net/ado.net to create a very simple user interface. (Everything works if I use STATICALLY created textBoxes... but not when I make them DYNAMICALLY.) 1. Execute a SQL...
5
by: BLACKDOG157 | last post by:
I've made a form with a variable number of textboxes. The user fills them out, and then I need to pick up the values he has filled in. The number of textboxes vary depending on a value that the...
5
by: Amoril | last post by:
I've read quite a few different message on various boards and for some reason I'm still having trouble wrapping my head around this viewstate maintenance and trying to get these dynamically created...
1
by: TF | last post by:
This group came through for me last time so here we go again. My page shows paint colors, brand name, product code, etc in a gridview with the background matching the paint color. Several links on...
1
by: JFKJr | last post by:
Hello everyone, the following Access VBA code opens an excel file and creates textboxes in a given range of cells dynamically. The code attaches "MouseUP" and "Exit" events to the textboxes (using...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
1
by: adarshyam | last post by:
can anybody tel me how to clear values from dynamically created text boxes?? using a clear button.. this is the code used to create dynamic text boxes.. if i press clear button then it must clear all...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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
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,...
0
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...

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.