如何使用Asp.Net控件代替Html控件? [英] How Can I Use Asp.Net Control In Place Of Html Control?
本文介绍了如何使用Asp.Net控件代替Html控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
// This is html control
<input type="text" value="Email ID /Username" class="login-input">
// This is asp.net control
<asp:TextBox ID="TextEmail" runat="server">
当我使用asp.net控件时出现错误..你可以帮我吗?我如何使用asp.net控件?
错误:
when i use asp.net control there is error arise.. can u help me for that.? how can i use asp.net control?
ERROR :
Control 'TextEmail' of type 'textbox' must be placed inside a form tag with runat=server
推荐答案
听取错误信息,将你的asp.net控件包装在表单中标签,例如:
Listen to the error message, Wrap your asp.net controls inside form tag, e.g:
<form id="form1" runat="server">
<asp:textbox id="TextEmail" runat="server" ></asp:textbox>
</form>
Quote:
Control 'textbox'类型的'TextEmail'必须放在带有runat = server
Control 'TextEmail' of type 'textbox' must be placed inside a form tag with runat=server
的表单标签内。错误消息会告诉您所有内容。如果您要使用 ASP.NET TextBox
,那么表单
标记应包含 runat =server
属性。
此外,控件应放在 form
。
The error messages tells you everything. If you are going to use ASP.NET TextBox
, then form
tag should contain a runat="server"
attribute.
Moreover, the control should be placed inside the form
.
确保所有服务器控件都嵌入在表单标签中
Make sure that all your server controls are embedded inside the form tag
<form id="form1" runat="server">
<!-- other markup (if any) -->
<asp:textbox id="TextEmail" runat="server" ></asp:textbox>
<!-- other markup (if any) -->
</form>
希望,它会有所帮助:)
Hope, it helps :)
这篇关于如何使用Asp.Net控件代替Html控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文