473,585 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ToSt ring()
lbLabel.Text = myReader("param eter") & " "
lbLabel.Font.Bo ld = True
lbLabel.Font.Si ze = FontUnit.Parse( 15)

lbLabel.ForeCol or = Color.Navy
Page.Controls.A dd(lbLabel)
txtBox.ID = "Textbox" + parCounter.ToSt ring()
Page.Controls.A dd(txtBox)
Page.Controls.A dd(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 1233
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.ToSt ring()];
if ( s == null ) break; //leaves for loop

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

HTH,

bill
"SD" <sd@nospam.ne t> wrote in message
news:1115297659 .b4aef7576e0c3f 7bbf7d1eb29005b 9ce@teranews...
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.ToSt ring()
lbLabel.Text = myReader("param eter") & " "
lbLabel.Font.Bo ld = True
lbLabel.Font.Si ze = FontUnit.Parse( 15)

lbLabel.ForeCol or = Color.Navy
Page.Controls.A dd(lbLabel)
txtBox.ID = "Textbox" + parCounter.ToSt ring()
Page.Controls.A dd(txtBox)
Page.Controls.A dd(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.ToSt ring()];
if ( s == null ) break; //leaves for loop

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

HTH,

bill
"SD" <sd@nospam.ne t> wrote in message
news:1115297659 .b4aef7576e0c3f 7bbf7d1eb29005b 9ce@teranews...
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.ToSt ring()
lbLabel.Text = myReader("param eter") & " "
lbLabel.Font.Bo ld = True
lbLabel.Font.Si ze = FontUnit.Parse( 15)

lbLabel.ForeCol or = Color.Navy
Page.Controls.A dd(lbLabel)
txtBox.ID = "Textbox" + parCounter.ToSt ring()
Page.Controls.A dd(txtBox)
Page.Controls.A dd(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
5279
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 with text, and in each row, there 's atextBox (with an incremental ID number) in witch the user canenter a number of products. When the user clicks...
4
1783
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 the relevant text properties of several textboxes (to allow for edit) ....all simple so far. I have a save button that when clicked will then perform...
5
2580
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 SELECT cmd to retrieve a record. 2. Loop through the dataReader values, creating textBox boxes dynamically, adding them to a Panel. (The database...
5
1695
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 user filled in in another page. But suppose there were 3 values. In that case, I know the names of the fields, they are MyTextBox1 MyTextbox2...
5
6749
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 link buttons to stay wired up to their click events. I have what is basically a simply survey question generation page. The page first displays...
1
1952
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 the page are used to call itself with querystring values for brand, thinner, finish, etc. The page must show all colors if the querystring is...
1
6306
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 the following "DateTextBox" class module). Whenever a user enters in to the textbox, the code displays "Please enter date in mm/dd/yyyy format (for...
7
6646
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 tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: ...
1
1795
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 the values entered in al the textboxes Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load If...
0
7836
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...
0
8199
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8336
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...
1
7950
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8212
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...
0
6606
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...
0
5389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3835
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...
0
1175
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...

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.