C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




ignore spaces


Posted Date: 08 Aug 2008      Total Responses: 3

Posted By: kumar       Member Level: Bronze     Points: 1



hi friends,

i am having two textboxes(autopostback=true) and a button to update those fields,now if i am entering spaces in that textbox and clicking button it should not fire any events like validation messages and focus should be there in 1st textbox...

thanx
kumar





Responses

Author: vasanthiraajan    08 Aug 2008Member Level: GoldRating:     Points: 1

hi,

You can String Functions

vb.net:
Strings.Trim(Textbox1.Text)

Regards,
Vasanthi



Author: monika choudhary    08 Aug 2008Member Level: SilverRating:     Points: 4

use the below regular expression for spaces also u can use txtVlaue.trim();

<asp:TextBox id="txtValue2" runat="server">
</asp:TextBox>

<asp:RequiredFieldValidator id="reqField2"
runat="server"
ErrorMessage="The above field should not be left blank"
ControlToValidate="txtValue2">
</asp:RequiredFieldValidator>



Author: MANOJ MATHE    08 Aug 2008Member Level: GoldRating:     Points: 5

HI,
you can do it in 2 ways
1. Write a javscript method on button click in which you need to check the textbox value and if the value matches to space just retun false then it wnt be calling the server method

2. implement onfocus change method in javascript in which it will check the textbox value if it is space then just make the focus again to textbox.

If my approach is wrong just inform me



Post Reply
You must Sign In to post a response.
Next : sms code
Previous : Helicon system analyser
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use