Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 01, 2012 11:57 AM by roopeshreddy
Member
41 Points
91 Posts
Jun 01, 2012 08:57 AM|LINK
<asp:HiddenField ID="hdnBlockRefresh" runat="server"/> <script type="text/javascript"> function BlockGridRefresh() { document.getElementById('hdnBlockRefresh').Value = '0'; alert(document.getElementById('hdnBlockRefresh').value); } function GridRefresh() { document.getElementById('hdnBlockRefresh').Value = '1'; } </script>
And
txtTechnician.Attributes.Add("onfocus", "BlockGridRefresh()"); txtTechnician.Attributes.Add("onblur", "GridRefresh()");
I have a griView with many textboxes with the same id and i want to set the hiddenField value when is no focus one of them.
If a pun alert in BlockGridRefresh is displayed over and over again...and my hiddenField value is not set. Why this is happening?
TY
All-Star
15346 Points
3142 Posts
Jun 01, 2012 09:07 AM|LINK
try using using clientID fro example
document.getElementById('<%=hdnBlockRefresh.ClientID%>').Value = '0';
554 Points
123 Posts
Jun 01, 2012 09:08 AM|LINK
Hi,
try to get hidden field control like this.....
document.getElementById("hiddenfieldID")
(or)
document.getElementById("<%=hiddenfieldID.ClientID%>")
Jun 01, 2012 09:43 AM|LINK
Still doesnt work :(
325 Points
80 Posts
Jun 01, 2012 11:08 AM|LINK
U have used .Value but javascript is case sensitive U need to use .value ( lowercase 'v').
document.getElementById('hdnBlockRefresh').value = '0';
and make sure the Id name is same as client ID
:)
Contributor
2280 Points
659 Posts
Jun 01, 2012 11:14 AM|LINK
hi
it may help you
http://csharpektroncmssql.blogspot.in/2012/04/dynamic-css-styles-in-aspnet.html
Star
7983 Points
2099 Posts
Jun 01, 2012 11:18 AM|LINK
Hai
http://stackoverflow.com/questions/7756740/focus-does-not-seem-to-work-after-onblur
http://www.daniweb.com/web-development/php/threads/409537/onfocusfunction-in-generated-html-doesnt-work
thank u
20277 Points
3349 Posts
Jun 01, 2012 11:57 AM|LINK
I think until you submit the form, you can't access the Hidden field variable value!
What you can do is, assign the value to a temp variable and access it!
Hope it helps u...
seiko88
Member
41 Points
91 Posts
OnFocus function does not work
Jun 01, 2012 08:57 AM|LINK
<asp:HiddenField ID="hdnBlockRefresh" runat="server"/> <script type="text/javascript"> function BlockGridRefresh() { document.getElementById('hdnBlockRefresh').Value = '0'; alert(document.getElementById('hdnBlockRefresh').value); } function GridRefresh() { document.getElementById('hdnBlockRefresh').Value = '1'; } </script>And
txtTechnician.Attributes.Add("onfocus", "BlockGridRefresh()");
txtTechnician.Attributes.Add("onblur", "GridRefresh()");
I have a griView with many textboxes with the same id and i want to set the hiddenField value when is no focus one of them.
If a pun alert in BlockGridRefresh is displayed over and over again...and my hiddenField value is not set. Why this is happening?
TY
Mudasir.Khan
All-Star
15346 Points
3142 Posts
Re: OnFocus function does not work
Jun 01, 2012 09:07 AM|LINK
try using using clientID fro example
document.getElementById('<%=hdnBlockRefresh.ClientID%>').Value = '0';Maneel
Member
554 Points
123 Posts
Re: OnFocus function does not work
Jun 01, 2012 09:08 AM|LINK
Hi,
try to get hidden field control like this.....
document.getElementById("hiddenfieldID")
(or)
document.getElementById("<%=hiddenfieldID.ClientID%>")
seiko88
Member
41 Points
91 Posts
Re: OnFocus function does not work
Jun 01, 2012 09:43 AM|LINK
Still doesnt work :(
samuraikensh...
Member
325 Points
80 Posts
Re: OnFocus function does not work
Jun 01, 2012 11:08 AM|LINK
Hi,
U have used .Value but javascript is case sensitive U need to use .value ( lowercase 'v').
document.getElementById('hdnBlockRefresh').value = '0';and make sure the Id name is same as client ID
:)
bhaskar.mule
Contributor
2280 Points
659 Posts
Re: OnFocus function does not work
Jun 01, 2012 11:14 AM|LINK
hi
it may help you
http://csharpektroncmssql.blogspot.in/2012/04/dynamic-css-styles-in-aspnet.html
Site:Rare technical solutions
RameshRajend...
Star
7983 Points
2099 Posts
Re: OnFocus function does not work
Jun 01, 2012 11:18 AM|LINK
Hai
http://stackoverflow.com/questions/7756740/focus-does-not-seem-to-work-after-onblur
http://www.daniweb.com/web-development/php/threads/409537/onfocusfunction-in-generated-html-doesnt-work
thank u
roopeshreddy
All-Star
20277 Points
3349 Posts
Re: OnFocus function does not work
Jun 01, 2012 11:57 AM|LINK
Hi,
I think until you submit the form, you can't access the Hidden field variable value!
What you can do is, assign the value to a temp variable and access it!
Hope it helps u...
Roopesh Reddy C
Roopesh's Space