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 GilbileRank #268 · 9.4K reputationPosted Mar 28, 2013, 8:43 PM EDT
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.
Jaish MathewsRank #225 · 11K reputationPosted Mar 28, 2013, 9:01 AM EDT
SUNIL GUTTARank #1,832 · 810 reputationPosted Mar 28, 2013, 10:40 AM EDT
SUNIL GUTTARank #1,832 · 810 reputationPosted Mar 29, 2013, 5:56 AM EDT
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 :)
Vishal GilbileRank #268 · 9.4K reputationPosted Mar 30, 2013, 3:56 AM EDT
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.