This is a migrated thread and some comments may be shown as answers.

[Solved] Numeric Textbox posts back on focus...

1 Answer 105 Views
Input
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 27 Feb 2008, 09:11 AM
I'm running into an issue where my numeric textbox is posting back when I set focus on it with javascript.

I have a popup panel that calls a script which sets focus to the numeric textbox when it is shown.  The script below is what is getting called when the panel is shown.  The GetVerifyClientID is a function in the codebehind which grabs the ClientID of the Numeric Textbox.  This works fine if I swap out for a standard asp textbox. 

<script type='text/javascript' >function SetVerifyFocus(){$get('<%=GetVerifyClientID() %>').focus();}</script> 
 

If I modify the script above to the following, it seems to pop up the telerik control's name just fine...

<script type='text/javascript' >function SetVerifyFocus(){alert('<%=GetVerifyClientID() %>');}</script> 

For whatever reason, when I allow the top function to be called, the page posts back again.  I'm unsure of what to turn off on the telerik control so that it doesn't post back when focus is set to it.  I need it to be able to post back afterward so the user can hit enter after putting in a value (I have this functionality currently, I just don't want to lose it).

Also, if I view source on the page, the script seems to be getting created with the correct control ID.

Thanks in advance for any help!

Robert

1 Answer, 1 is accepted

Sort by
0
Robert
Top achievements
Rank 1
answered on 27 Feb 2008, 09:16 AM
Nevermind... I figured it out.

As I was looking (more carefully) through the page source, I noticed that there were a lot of <input tags for the numeric textbox and I needed to reference the one with _text on it.

The long and short of it is that I needed to modify my GetVerifyClientID function to tack on "_text" to the ClientID.

Just in case anyone else runs into this.

Tags
Input
Asked by
Robert
Top achievements
Rank 1
Answers by
Robert
Top achievements
Rank 1
Share this question
or