473,569 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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:ImageButto n runat="server" id="submit"
ImageUrl="submi t.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
Nov 19 '05 #1
1 874
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
"Shapper" <mdmoura*NOSPAM *@gmail.*DELETE 2SEND*com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
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:ImageButto n runat="server" id="submit"
ImageUrl="submi t.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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2209
by: Drew Berkemeyer | last post by:
Hello, How can I use XSD to ignore certain nodes of an XML document. Specifically, we have an event that I want to define using XSD. I then want to validate incoming XML events with that XSD. However, I want the payload section of the event to be freeform and thus, *NOT* validated. Is there a way to define a node (and all of it's...
3
3033
by: Gary Varga | last post by:
In the file WebUIValidation.js, when a postback that doesn't fail the validation has a javascript error saying summary is undefined in the ValidationSummaryOnSubmit function. Page_ValidationSummaries has a length of 1 but there are no array entries. This is the line that fails: summary.style.display = "none";
6
3694
by: Nedu N | last post by:
Hi, I want to have confirmation(Yes/No) on a button of the webform in which there are many validation controls. I want all the validation controls to be triggered first and then Yes/No confirmation message. By adding just an confirm attribute for 'onclick' event of the button doesn't work with validation controls. Is there any short way to...
3
2868
by: Earl Teigrob | last post by:
Can a Modal Dialog Box do forms ASP.NET forms validation from within the Modal Box? I want to pop up a dialog box to the user and have it do its own post backs with validation checking and then save the data and close the dialog when the page is valid. I have read a little about using Iframes to post back to, but was wondering if this would...
3
1215
by: Shapper | last post by:
Hello, Could someone point me a good validation control for ASP.Net? Thank You, Miguel
2
1033
by: Saket Mundra | last post by:
I have following queries regarding Client side validation : 1) I am using a ASP.NET web Control on my form to submit the data entered by the user. I want to perform Validation when the user clicks this Button. However i have no idea how to call a client side javascript function on the button click ? pls help 2) Also I want that the form...
8
1776
by: john | last post by:
I need Help!!! Please I need to write a javascript that will do the following Show a user name User address User Phone Number City State zip code telephone number
5
1907
by: Peter Afonin | last post by:
Hello, I'm not an expert in Javascript, so I'm seeking an advice. As I mentioned in my previous post, I use Javascript to check whether at least one checkbox in the datagrid has been checked. I have to use Stringbuilder to do this: Dim iCount As Int32 Dim sClientSideValidate As New StringBuilder
7
3592
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
3
6212
by: satishknight | last post by:
Hi, Can some one tell me how to change the validation sequence for the code pasted below, actually what I want it when any one enters the wrong login information (already registered users) then it has to tell then them its wrong information but currently it takes then to a next page and then tells them its incorrect information. This is tedious...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.