Reputation: 437
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
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