HTML5电子邮件输入无法分配ID和RUNAT ="服务器" ASP.NET 4 [英] HTML5 email input cannot assign ID and RUNAT="Server" ASP.NET 4
问题描述
嗨我想一个ID分配给HTML5输入,这样我可以在Web表单从code访问背后的价值。然而与此code:
Hi I am trying to assign an ID to an HTML5 input so that i can access its value from the code behind in the web form. However with the this code:
<input type="email" required autofocus placeholder="Email Address" class="txt-input txt-input-username" ID="myTextBox" runat="server" />
Visual Studio 2010中告诉我,它不能解析符号ID =myTextBox。
Visual Studio 2010 is telling me that it cannot resolve the symbol ID="myTextBox".
这是我怎么才能解决这个问题,因为我一直在寻找一个答案了将近一天的任何想法?谢谢
Any ideas on how i can fix this because i have been searching for an answer for nearly a day? thanks
推荐答案
ASP.Net 4.0 HtmlGenericControl不支持作为您code定义的类型属性,错误解释说, 分析器错误信息:电子邮件不是输入标记的有效类型的,这是在ASP.Net框架可以说是一个众所周知或容易发现错误
ASP.Net 4.0 HtmlGenericControl does not support the "Type" attribute as defined in your code, the error explains that, Parser Error Message: 'email' is not a valid type for an input tag., this is a arguably a "well known" or easily discovered bug in the ASP.Net framework.
有在此处列出了几种解决方案:
<一href=\"http://msdn.microsoft.com/en-us/magazine/hh547102.aspx\">http://msdn.microsoft.com/en-us/magazine/hh547102.aspxre
更新的框架和使用Asp.Net TextBox控件的斯科特猎人 - HTML 5的更新.NET 4
使用第三方ASP.Net Html5的UI控件如一个可从codePLEX。
类似的问题是问,并回答以下SO帖子:
<一href=\"http://stackoverflow.com/questions/3232079/how-can-i-use-html5-email-input-type-with-server-side-net\">How我可以使用HTML5电子邮件输入型与服务器端.NET - 这是相同的问题作为HtmlGenericControl但它是不是在更新中解决的
输入类型的服务器端控件
There are several solutions that are outlined here:
http://msdn.microsoft.com/en-us/magazine/hh547102.aspxre
Update the framework and use the Asp.Net TextBox control Scott Hunter - HTML 5 Updates for .NET 4
Use a 3rd party ASP.Net Html5 UI control such as the one available from Codeplex.
A similar question is asked, and answered on the following SO posts:
How can I use HTML5 email input type with server-side .NET - This is the same issue as for the HtmlGenericControl however it is not addressed in the update
input types on server side controls
我个人的preference最终被转移到 ASP.Net MVC 3 ,其相当陡峭的学习曲线和一个大的变化从ASP.Net Web开发的Web窗体的风格但它很快就忘记了,一旦你习惯了symantics和编码风格。
My personal preference ended up being to move to ASP.Net MVC 3, its quite a steep learning curve and a big change from the "Web Forms" style of ASP.Net web development however its soon forgotten once you get used to the symantics and coding styles.
这篇关于HTML5电子邮件输入无法分配ID和RUNAT =&QUOT;服务器&QUOT; ASP.NET 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!