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

[Solved] RadTextBox.ClientEvents.OnButtonClick Error

5 Answers 240 Views
Input
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 06 Feb 2009, 04:37 PM
I get the following javascript error when loading a page where a RadTextBox control exists after setting the RadTextBox.ClientEvents.OnButtonClick property server-side:

"Object expected."

And this error only shows up after setting this property like so:

textBox.ClientEvents.OnButtonClick = "OpenLookupResultsWindow(0, 8)"

If you view the source the you can see that button associated with the textBox looks like this:

 
<td class="riBtn"><href="#" onclick="return false;" id="HeaderGridDock_C_HeaderGrid1_radGrid_ctl00_ctl04_HeaderGridTextBox-0-0_GoButton"><span>Button</span></a></td> 

And the JavaScript generated by Telerik looks like so:

Sys.Application.add_init(function() { 
    $create(Telerik.Web.UI.RadTextBox, {"_focused":false,"clientStateFieldID":"HeaderGridDock_C_HeaderGrid1_radGrid_ctl00_ctl04_HeaderGridTextBox-8-0_ClientState","enabled":true,"showButton":true,"styles":{HoveredStyle: ["width:97px;""riTextBox riHover"],InvalidStyle: ["width:97px;""riTextBox riError"],DisabledStyle: ["width:97px;""riTextBox riDisabled"],FocusedStyle: ["width:97px;""riTextBox riFocused"],EmptyMessageStyle: ["width:97px;""riTextBox riEmpty"],ReadOnlyStyle: ["width:97px;""riTextBox riRead"],EnabledStyle: ["width:97px;""riTextBox riEnabled"]}}, {"buttonClick":OpenLookupResultsWindow(0,8)}, null, $get("HeaderGridDock_C_HeaderGrid1_radGrid_ctl00_ctl04_HeaderGridTextBox-8-0")); 

Any ideas why I'm getting this error? I am unable to click the textBox button as a result.

Thanks,
Andrew

5 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 09 Feb 2009, 04:05 PM
Hello Andrew,

You can specify merely the name of the OnButtonClick client handler of RadTextBox (without passing parameters to it), namely:

textBox.ClientEvents.OnButtonClick = "OpenLookupResultsWindow";  
 
 
 
 
 

The two arguments passed in the client event handler are always of the same type - sender (which is the client object of the textbox itself) and eventArgs (depending on the type of the event raised).

Further information about the client-side events of our RadInput controls can be gathered from this topic.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
muthalagappan muthiah
Top achievements
Rank 1
answered on 21 Aug 2009, 02:15 PM
Hi,
It works with setting the parameters.

However in my case, I want to pass the parameters (because I want to use other controls value for validation)
Please help.


Regards
Muthu
0
Dimo
Telerik team
answered on 21 Aug 2009, 02:20 PM
Hello Muthu,

By design the client event handlers, based on the MS AJAX conventions, do not accept custom parameters. You will need to store and pass the parameter values in some other way, e.g. create a Javascript array on the client, use some hidden fields, etc - it depends on your preferences.

Kind regards,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
muthalagappan muthiah
Top achievements
Rank 1
answered on 21 Aug 2009, 02:34 PM
Thanks for your speedy response.

Clientarray or hidden values can't work in my case. I have  a set RadDatePicker in a grid.

I just want to validate the date(comparing with other raddatepicker value and changing the value)
by calling by fucntion.

Anyway can i attached a javascript function?

Plz help

Regards
Muthu
0
Sebastian
Telerik team
answered on 24 Aug 2009, 12:53 PM
Hello muthalagappan,

You can utilize the client API of RadDatePicker in order to extract the selected date from the active date picker. To compare the value with other date pickers' dates in the grid,  consider the technique to access RadDatePickers in grid templates on the client presented here.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Input
Asked by
Andrew
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
muthalagappan muthiah
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or