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

Get values from textboxes created by code

Hello!

I'm pretty novice in .NET and having a problem to get values from my
textboxes which I have created dynamicly in my aspx.cs-file. (I'm using
Visual Studio 2005).

I create them like this (code-snippet):
f = getFormField(fields, "a_dbfield");

Response.Write("<td>" + f.getLabel() + "</td>");

Response.Write("<td >" + f.getHtmlFormString() + "</td>");

f.getHtmlFormString() gives me a string with generated html, like "<input
type='text' runat='server' id='a_dbfield'>".

I wonder how I can reach the values on the server-side from this dynamicly
created textbox?

The tags are surrounded with a <form id="bla" runat="server"which is
created in the design mode.

Hope someone could help!

Regards, Mike

Oct 19 '06 #1
2 1057
Page.Request.Form is a namevalue collection of postback name and values. one
odd feature is if you have two form elements with the same name, the values
are concatenated together with a comma separator.

-- bruce (sqlwork.com)
"Mike" <do*********@domain.comwrote in message
news:DL******************@newsb.telia.net...
Hello!

I'm pretty novice in .NET and having a problem to get values from my
textboxes which I have created dynamicly in my aspx.cs-file. (I'm using
Visual Studio 2005).

I create them like this (code-snippet):
f = getFormField(fields, "a_dbfield");

Response.Write("<td>" + f.getLabel() + "</td>");

Response.Write("<td >" + f.getHtmlFormString() + "</td>");

f.getHtmlFormString() gives me a string with generated html, like "<input
type='text' runat='server' id='a_dbfield'>".

I wonder how I can reach the values on the server-side from this dynamicly
created textbox?

The tags are surrounded with a <form id="bla" runat="server"which is
created in the design mode.

Hope someone could help!

Regards, Mike



Oct 19 '06 #2
Recreate the tex box with same ID on postback and get the new value using
Text property itself.

"Mike" <do*********@domain.comwrote in message
news:DL******************@newsb.telia.net...
Hello!

I'm pretty novice in .NET and having a problem to get values from my
textboxes which I have created dynamicly in my aspx.cs-file. (I'm using
Visual Studio 2005).

I create them like this (code-snippet):
f = getFormField(fields, "a_dbfield");

Response.Write("<td>" + f.getLabel() + "</td>");

Response.Write("<td >" + f.getHtmlFormString() + "</td>");

f.getHtmlFormString() gives me a string with generated html, like "<input
type='text' runat='server' id='a_dbfield'>".

I wonder how I can reach the values on the server-side from this dynamicly
created textbox?

The tags are surrounded with a <form id="bla" runat="server"which is
created in the design mode.

Hope someone could help!

Regards, Mike

Oct 20 '06 #3

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

Similar topics

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...
2
by: phpachu | last post by:
Hi, I hav created a group of textboxes using a loop and its names are unique and names are assigned using variable ( like <input type=text name=$name1>). Then How can i retrieve the values in...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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: 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
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...

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.