[英]Control 'ctl00_txtDebug' of type 'TextBox' must be placed inside a form tag with runat=server
I am trying to render a ascx control as a view in MVC and I am getting the following error 我试图将ascx控件呈现为MVC中的视图,但出现以下错误
Control 'ctl00_txtDebug' of type 'TextBox' must be placed inside a form tag with runat=server.
类型为'TextBox'的控件'ctl00_txtDebug'必须放置在带有runat = server的表单标记中。
The debugger stops on this line in the ascx control 调试器在ascx控件的这一行停止
function dtpaging_Page_Selected(vPageNumber) {
document.getElementById("<%=mControlName %>txtPageNumber").value = vPageNumber
<%=Post_Method %>
}
So I am thinking that my method is working to get the control and begin the rendering. 因此,我认为我的方法正在努力获取控件并开始渲染。 Why would it throw this error?
为什么会引发此错误? I can attach more code if needed
如果需要,我可以附加更多代码
I found the answer to this question. 我找到了这个问题的答案。 I have to contain the entire ascx page in the
<form runat="server">.....</form>
tags. 我必须在
<form runat="server">.....</form>
标记中包含整个ascx页面。 It really was that simple 真的就是这么简单
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.