Hi friends
Well i hope my code is correct
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Attributes.Add("onblur","ValidatorsValidate("+RequiredFieldValidator1.ClientID+"+)");
}
My basic need is when i don't enter anything in text-box and press tab key or enter key likely the focus shouldn't shift from my text-box until unless i enter something ??
I hope the above code is for that purpose only ??
Ty
Loading

Vishal GilbilePosted Mar 29, 2013, 12:43 AM
My suggestion for your problem would be you make use of Mark up file instead of doing it programitically. For Eg:- Call the javascript function from markup file where you textbox markup is written.
Hope that solves your problem.
With Regards,
Vishal Gilbile.
Vishal GilbilePosted Mar 30, 2013, 7:56 AM
The following error is coming because you might have placed your control before form tag. all your controls must be placed inside the form tag.
With Regards,
Vishal Gilbile.
SUNIL GUTTAPosted Mar 29, 2013, 9:56 AM
It worked for me for some extent when i tried to copy ur mentioned code in my source view under head tag :)
Control 'txtNum' of type 'TextBox' must be placed inside a form tag with runat=server
i am getting above error so i
Removed code mentioned above :) results became better but not perfect as when i am pressing tab key or mouse click on next text box its loosing focus :(
Main problem with me is i am weak at java script , html :) thats the reason i went for ONBLUR event :)
SUNIL GUTTAPosted Mar 28, 2013, 2:40 PM
Jaish MathewsPosted Mar 28, 2013, 1:01 PM