theXs
theXs

Reputation: 437

Access generated INPUT Fields

Hi I'm currently generating a couple of input boxes via c# and I would like to access them later to save the entered data back to the database. However I am not sure on how to access the generated input boxes.

I generate them like this:

sb.Append("<input name=\"txtThekeUpdate[" + thekenRow["ID"] + "]\" type=\"text\" id=\"MainContent_txtBetreiber\" class=\"textEntry\" value=\" " + thekenRow["Name"] + "\"/><br />");

txtThekeUpdate is an Array since I am planning on entering multiple updated datasets at once.

Do you know how I could access them with the corresponding ID?

Upvotes: 0

Views: 69

Answers (1)

Sanj
Sanj

Reputation: 3870

These values will be in the Form element of post back call

var value = Form["txtThekeUpdate_" + thekenRow["ID"]];
if (value != null)
{
      Data = value;
}

You can try this.

Also try not to use [ in the name value it will only cause you grief if later you want to access via Java.

Upvotes: 1

Related Questions