asp.net - How can I make a validation icon appear beside a asp:textbox? -
Using this code, I can get a very cool red written message.
& lt; Form id = "frmValidator" verb = "required.aspx" method = "post" runat = "server" & gt; Enter your name: & lt; Asp: text box id = "txtName" runat = "server" /> & Lt; Asp: RequiredFieldValidator id = "valTxtName" ControlToValidate = "txtName" error message = "Please enter your name!" Runat = "server" /> & Lt; Br / & gt; & Lt; ASP: Button ID = "BTN submit" text = "run" = "server" /> & Lt; / Form & gt;
Do I have a way for a green icon (I have that picture, so I imagine that I have to give it a reference) fade in existence next to the control?
Thanks a bunch :)
You can do this
& lt;% @page language = "c #" autoinwarewireUP = "true" codefile = "default.aspx.cs" inherits = "_default"%> & Lt ;; DOCTYPE HTML PUBLIC "- // W3C // DTT XHTML 1.0 Transcription // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Head runat = "server" & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; Style type = "text / css" & gt; & Lt; / Style & gt; & Lt; Link href = "StyleSheet.css" rel = "stylesheet" type = "text / css" /> & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form id = "form1" runat = "server" & gt; & Lt; Div & gt; & Lt; ASP: Text Box ID = "Text Box 1" Runat = "Server" & gt; & Lt; / Asp: text box & gt; & Lt; Asp: RequiredFieldValidator ID = "RequiredFieldValidator1" runat = "server" border style = "none" controllow validity = "textbox 1" CssClass = "newStyle1" & gt; & Lt; / Asp: RequiredFieldValidator & gt; & Lt; / Div & gt; & Lt; ASP: Button ID = "Button 1" Runat = "Server" Text = "Button" /> & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt; .newStyle1 {background-image: url ('Pic.png'); Width: 500px; Height: 300px; }
So basically just do not have any text for the error message and set the CSS property in the validation control for the CSS class.
Comments
Post a Comment