Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dears,
I am using a view user control in MVC3 that has a checkboxlist bound to an object
whenever I call the user control in another View
ASP.NET
 <form id="form1"  runat="server">
<div> 
 <%:@Html.Partial("ViewUserControl1")%>
</div>

and try to run my application , I have the following error
Control '4_CheckBoxList1_0' of type 'CheckBox' must be placed inside a form tag with runat=server

[edit]SHOUTING removed, code block added - OriginalGriff[/edit]
Posted
Updated 2-Jul-12 21:53pm
v2
Comments
OriginalGriff 3-Jul-12 3:54am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.

1 solution

You should try Html.RenderPartial instead of Html.Partial - although I don't think that it is a wise idea to mix classic asp.net with MVC...
 
Share this answer
 
Comments
Sandra Ha 3-Jul-12 4:17am    
I have used <div><% Html.RenderPartial("ViewUserControl1"); %></div> , but the same problem stayed!
Zoltán Zörgő 3-Jul-12 4:53am    
Hmmm... Try the suggestion here: http://yorkstart.wordpress.com/2007/07/15/how-to-solve-must-be-placed-inside-a-form-tag-with-runatserver-error/
Zoltán Zörgő 4-Jul-12 17:14pm    
any progress?
Sandra Ha 6-Jul-12 7:17am    
No :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900