Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with allowing multiple server forms on the same page

Status
Not open for further replies.

jelrod63

Programmer
Dec 26, 2006
10
US
I have a userControl that is in a form that is being called from a page that is in a form. I'm getting a error that says you can only have one form per page.

I'm fairly new to ASP.NET and this may be a dumb question but why can't ASP.NET allow multiple server forms to be on the same page? That being the case what is the correct way to go about it.

I have a userControl that has a asp:GridView because I need to use the asp:TemplateField and to my understanding they do not work without it being in a form but I'm calling it from my main page that is in a form as well.

I really have racked my brain on getting this to work for many days and I just have not had any luck. So I'm hoping someone that has had this problem can help me out.

Thank you in advance for helping someone trying to get better at programming.
 
I have a userControl that has a asp:GridView because I need to use the asp:TemplateField and to my understanding they do not work without it being in a form but I'm calling it from my main page that is in a form as well.

I am completely confused by your post. You have a usercontrol that contains a Gridview, correct? And you place that UserControl on a page, correct?

Jim
 
Yes I have UserControl that contains a Gridview and that UserControl is being place on a page that has a form. When I try to run the page I'm getting an error that says the page can only contain one form. I was wondering if there was a work-around of some sort.

Thank you for replying and I'm sorry for the confusion.
 
There should be no problem at all.. all you have to do is drop your usercontrol on the page. If in code you added <form> tags, then yes you will have a problem. There is no need to add those tags on user control with server controls on it. This is becuase the usercontrol will be placed on the page within the page's <form> tags.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top