Append Parameter to Javascript function attached to OnClientTabSelected

6 posts, 0 answers
  1. Wisanto
    Wisanto avatar
    1 posts
    Member since:
    Aug 2011

    Posted 23 Aug 2011 Link to this post

    From telerik website:

    Use the OnClientTabSelected property to specify a JavaScript function that will be executed after a tab is selected - either by left-clicking it with a mouse or hitting enter after tabbing to that tab.

    Two parameters are passed to the handler

    • sender (the client-side RadTabStrip object)
    • eventArgs with one property
      • Tab - the instance of the selected tab

    From my understanding, telerik will automatically pass 2 parameters to the handler, and we don't have to specify the parameters. However, what if I need to pass an extra parameter, something like below, how do I do it? 

    function ClientTabSelectedHandler(sender, eventArgs, name) {

                <telerik:RadTabStrip ID="radTabStripTicketInfo" runat="server" 
                    SelectedIndex="0" OnClientTabSelected="ClientTabSelectedHandler(sender, eventArgs, anotherControlID)">
                        <telerik:RadTab runat="server" Text="1" Selected="True">
                        <telerik:RadTab runat="server" Text="2">
                        <telerik:RadTab runat="server" Text="3">
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Aug 2011 Link to this post

    Hello Wisanto,

    In order to pass parameters, you should handle it as shown below.
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" ScrollChildren="true"
               OnClientTabSelected="function(sender, args){SelectTab(sender, args, 'Value1');}" >
      . . .....

    function SelectTab(sender, args, arg1)
       alert("Argument passed is arg1-" + arg1);

  3. Kalaiyarasi
    Kalaiyarasi avatar
    1 posts
    Member since:
    Jun 2013

    Posted 07 Jun 2013 Link to this post


    I tried the same code for RadDatePicker but it did not work. Please help.

    Thanks & Regards,
  4. Eyup
    Eyup avatar
    3644 posts

    Posted 12 Jun 2013 Link to this post

    Hello Kalaiyarasi,

    Here is a working sample:
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server">
        <ClientEvents OnDateSelected="function(sender,args){dateSelected(sender,args,'customArgument')}" />
    function dateSelected(sender, args, argument) {

    Hope this helps.

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  5. Michael Hunt
    Michael Hunt avatar
    42 posts
    Member since:
    Aug 2009

    Posted 04 Dec 2014 in reply to Princy Link to this post

    All of you at Telerik are awesome.  This type of functionality is a lifesaver!

    This should be documented in some help file...  or maybe it is, but I didn't see it.
  6. Eyup
    Eyup avatar
    3644 posts

    Posted 09 Dec 2014 Link to this post

    Hello Michael,

    I'm glad the provided approach has proven helpful. Perhaps, we should create a help article about this, indeed.
    Thank you for your feedback.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top