简体   繁体   English

类型为'TextBox'的控件'ctl00_txtDebug'必须放置在带有runat = server的表单标记中

[英]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.

相关问题 类型为“ RadioButton”的控件“ ctl00”必须置于带有runat = server的表单标记中 - Control 'ctl00' of type 'RadioButton' must be placed inside a form tag with runat=server 类型为&#39;TextBox&#39;的控件&#39;ctl07&#39;必须放置在带有runat = server的表单标记中。 - Control 'ctl07' of type 'TextBox' must be placed inside a form tag with runat=server. 类型为“ DataControlLinkBut​​ton”的控件“ DataLoading1_gdvDataGroups_ctl01_ctl00”必须置于带有runat = server的表单标记中 - Control 'DataLoading1_gdvDataGroups_ctl01_ctl00' of type 'DataControlLinkButton' must be placed inside a form tag with runat=server 'Button' 类型的控件 'ctl02' 必须放置在带有 runat=server 的表单标签内 - Control 'ctl02' of type 'Button' must be placed inside a form tag with runat=server 类型为“ HtmlEditorExtender”的控件必须放在带有runat = server的表单标签中 - Control of type 'HtmlEditorExtender' must be placed inside a form tag with runat=server &#39;TextBox&#39; 类型的控件 &#39;txtUserName&#39; 必须放置在带有 runat=server 的表单标签中 - Control 'txtUserName' of type 'TextBox' must be placed inside a form tag with runat=server 类型为&#39;TextBox&#39;的控件&#39;MainContent_forenameTxt&#39;必须放置在带有runat = server的表单标签中 - Control 'MainContent_forenameTxt' of type 'TextBox' must be placed inside a form tag with runat=server 必须将带有'LinkBut​​ton'类型的控件xxx放在带有runat = server的表单标签内 - Control xxx of type 'LinkButton' must be placed inside a form tag with runat=server “SPGridView”类型的控件“testGridview”必须放置在带有 runat=server 的表单标签内 - Control 'testGridview' of type 'SPGridView' must be placed inside a form tag with runat=server 必须放置在带有 runat=server 的表单标签内 - Must be Placed Inside a Form Tag With runat=server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM