background: I use a master page and my code is located in web content form.
GUI interface contains labels and Text boxes. a user will fill the form upon making a selection from a dropdown list. Once the form is populated,
a user can edit the form, then click update to save changes. The problem is that although the user does not see any errors upon making the update.
NO updates are successfully done. I debuged the code and realized the following:
List
Also, I do not know what is this code does:
this.Page.Form.Controls[11].Controls // why .Controls[11].Controls
here is the code that is causing the issue:
I have 3 more fieldsets like the one below. Each contain a table with a couple of rows
is like this one for all the
to the Database ....
Where is the trouble... I am not able to capture the controls of the form
Here is the code behind
List<Control> inputControls = (from Control c in this.Page.Form.Controls[11].Controls
where c.GetType() == typeof(TextBox) select c).ToList();
List<Control> divControls = (from Control c in this.Page.Form.Controls[11].Controls
where c.GetType() == typeof(HtmlGenericControl) &&
((HtmlGenericControl)c).TagName == "div"
select c).ToList();
even when I change the code to this.Page.Form.Controls, it does not work,
I am not sure if the issue is in the front page (textbox tags) I appreciate your help and support.
Bob
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kevin AungPosted Jan 15, 2011, 1:55 AM
"this.Page.Controls[11]" is most likely a container of some sort since the Linq query is selectin something from this.Page.Form.Controls[11].Controls.
to see what this is, you could do a couple of things:
Response.Write(this.Page.Controls[11].GetType().ToString());
When you get the type, say for instance it's a Panel, you could cast it and get the name:
Panel myPanel = (Panel)this.Page.Controls[11];
Response.Write(myPanel.ClientID);