|
Rank: Advanced Member Groups: Member
Joined: 7/26/2009 Posts: 36
|
I am trying to set focus to an asp.net textbox which is located within a callbackpanel which itself is located within one of your pageview.
I'm using the following javascript but without any success.
function btnAddNoteClick() { setTimeout( function() { document.JobCoachHomePageForm.TextBox1.focus(); }, 100); }
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Your set focus code is fine except that it will only work on IE. On other browser you will need to call document.getElementById to get a reference of the textbox object.
I do not know when you call this code though. You should be calling it AFTER the callback is done, which usually means handling the CallbackPanel's ClientSideAfterUpdate event and then call the set focus code from within that handler.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 7/26/2009 Posts: 36
|
Please forgive me if my questions sound green... I have no experience using javascript and your client side event handlers.
If I want to call the javascript function from the callbackpanels ClientSideAfterUpdate event do I simply type the javascript function's name ( btnAddNoteClick() ) in the control properties exposed with Visual Studio OR do I type the javascript code?
I tried typing btnAddNoteClick() in the CallbackPanel's ClientSideAfterUpdate property but it does not fire.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You should type in the function name only. Please see here for more details: http://doc.essentialobjects.com/library/1/clientapi_howto.aspxThanks
|
|