View Full Version : <asp:textbox> generates no type
In ASP.NET, the control <asp:textbox> generates an INPUT HTML element, but it generates it without the type attribute. In standard HTML (XHTML) INPUT elements need a type by all means. Well, yes, if no type specified, browsers evaluate the INPUT as a textbox, but it is not enough for me. I need to change, via javascript, some of the text CSS attributes (color, font-weight), but it is impossible without that type="text" HTML attribute.
Any idea?
Freon22
05-26-2009, 05:03 PM
I don't know what you are talking about.
<asp:TextBox ID="Text1" runat="server"></asp:TextBox>
Outputs
<input name="Text1" type="text" id="Text1" />
You have your id for the javascript and the type for CSS.
Hm... In fact one of my colleagues met this problem. He build the ASP.NET controls via Visual Studio. I saw the the generated code, first the ASP (and the ASP.NET control) than the HTML generated code. Surprisingly, the type is missing.
I'll tell him to dig out more inside the Visual Studio, I guess he missed something.
Thanx for the replay
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.