MVC3查看用户控制问题 [英] MVC3 view user control problem

查看:72
本文介绍了MVC3查看用户控制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,
我正在MVC3中使用具有绑定到对象的复选框列表的视图用户控件
每当我在另一个视图中调用用户控件时

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

 <form id="form1"  runat="server">
<div> 
 <%:@Html.Partial("ViewUserControl1")%>
</div>


并尝试运行我的应用程序,出现以下错误
类型为"CheckBox"的控件"4_CheckBoxList1_0"必须放置在带有runat = server
的表单标签中
[edit]删除SHOUTING,添加代码块-OriginalGriff [/edit]


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]

推荐答案

您应该尝试使用Html.RenderPartial而不是Html.Partial-尽管我不这样做认为将经典的asp.net与MVC混合在一起是一个明智的主意...
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...


这篇关于MVC3查看用户控制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆