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

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
 
A

Alvin Bruney [MVP - ASP.NET]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top