简体   繁体   English

输入类型=“电子邮件”设置值在asp.net代码后面

[英]input type=“email” set value in asp.net code behind

How can I assign value to 我该如何赋值给

<input type="email" class="form-control" placeholder="User name" required="" autofocus="" name="txtEmailId" id="txtEmailId" /> 

in the code behind? 在代码背后?

Use runat="server" with markup 使用带标记的runat="server"

<input type="email" runat="server" class="form-control" placeholder="User name" required="" autofocus="" name="txtEmailId" id="txtEmailId" /> 

Now on code behind you can access it via txtEmailId 现在txtEmailId代码,你可以通过txtEmailId访问它

As Html 5 control is not available using runat attribute. 由于使用runat属性无法使用Html 5控件。 You can directly use the TextBox like this 您可以像这样直接使用TextBox

<asp:TextBox ID="txtEmailId" runat="server" TextMode="Email"></asp:TextBox>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在asp.net后面的代码中访问类型文件的输入控件 - Accessing input control of type file in code behind asp.net 传递 Javascript 更新的值<input type="button">到 ASP.NET 代码后面 - Passing a Javascript-updated value from <input type="button"> to ASP.NET code behind 在ASP.NET c#代码隐藏中没有获得HTML输入类型的价值 - Not getting value of HTML input type in ASP.NET c# code-behind 从C#Asp.net后面的代码设置输入文本字段的值 - Set the value of input text field from code behind C# Asp.net asp.net和input type = file从后面的代码中读取多个数据 - asp.net and input type=file multiple read data from code behind 无法访问输入文本框值以在asp.net C#之后进行编码 - Not able to access input text box value to code behind asp.net c# asp.net正常html输入runat =“ server”在代码隐藏中返回未更新的值 - asp.net normal html input runat=“server” return non-updated value in code-behind 如何在javascript中设置asp.net隐藏字段并访问c#代码后面的值 - how to set asp.net hidden field in javascript and access the value in c# code behind 获取在document.ready中设置的隐藏字段的值,该值位于asp.net代码后面 - Grab hidden field's value that is set in document.ready in asp.net code behind ASP.NET 无法从后面的代码中为日期选择器设置值 - ASP.NET Can't set value to datepicker from code behind
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM