Get values from textboxes created by code

M

Mike

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
 
B

bruce barker \(sqlwork.com\)

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)
 
S

Siva M

Recreate the tex box with same ID on postback and get the new value using
Text property itself.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top