Validation in ASP.NET. Need some help. Thank You.

  • Thread starter Thread starter Shapper
  • Start date Start date
S

Shapper

Hello,

I have a form where I use the following tags:
Asp:Label, Asp:TextArea and Asp:ImageButton.

An example:
<asp:Label id="lmessage" runat="server">Message:</asp:Label>
<asp:TextArea rows="10" id="fmessage"></asp:TextArea>
<asp:ImageButton runat="server" id="submit"
ImageUrl="submit.gif"></asp:imagebutton>

I need to do the following when the send button is pressed:
If TextArea is empty.
1) Change text area background color to red.
2) Display message over text area: "Please Write your Message"
3) When the user places the mouse inside the text are the background
color changes again to the original color.

I have been making some tried in my aspx.vb code but until now I wasn't
able to understand how to create this.

Can somebody help me out?

Thanks,
Miguel
 
You will need to add some script to do this, it can't be done from the
server - side (for the most part).
So one approach is to handle the onclick event and put some javascript to
change the color etc

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
 
Back
Top