Multiple user controls on the same page fails Options
reneg
Posted: Monday, March 17, 2008 5:02:48 PM

Rank: Enthusiast

Joined: 1/24/2008
Posts: 27
Location: Fuglefjord, Faroe Islands
I've created my own usercontrol to log in, containing just 2 editboxes and a submit button. This works as it should. The usercontrol is in its own template and has the <?ASPNET_FORM> and </?ASPNET_FORM> surrounding the macro that renders the usercontrol.

Then I wanted to be able to log out. I had already created the usercontrol, so I made a macro to render it, and inserted it into my main template. I also surrounded this user control with the ASPNET_FORM tags.

This also worked, as long as I was logged in. But as soon as I pressed the logout button, I was redirected to the login page, and then I got this error: System.Web.HttpException: Control 'LoginForm_4_username' of type 'TextBox' must be placed inside a form tag with runat=server.

After trying to remove and re-add and such experiments, the diagnose is clear: My page fails when it tries to display the logout user control, AND the login user control.

Why is that?

Have I used the ASPNET_FORM tags incorrectly?
neehouse
Posted: Tuesday, March 18, 2008 2:01:55 PM

Rank: Umbracoholic

Joined: 7/20/2006
Posts: 1,038
Location: Charleston, West Virginia, United States
Hi Reneg,

ASP.NET is designed to only have a single ASP.NET form tag, thus, only one set of ASPNET_FORM is allowed in umbraco.

In your template, it is probably best to put the ASPNET_FORM tag adjacent to the BODY tags.

Code:

...
<body>
<?ASPNET_FORM>
...
</?ASPNET_FORM>
</body>
...




• 2007/2008 MVP • 2008/2009 MVP • Core Developer • Certified Professional Level I & II •
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.