Calling client side JavaScript function after Telerik RadPageView finishes loading

2 posts, 0 answers
  1. Rohhan
    Rohhan avatar
    1 posts
    Member since:
    Feb 2015

    Posted 11 Sep 2015 Link to this post

    m using Telerik UI for Specifically I'm using RadTabStrip with partial page postbacks to allow the user to tab through different sets of data. When the user clicks a tab, some code executes and loads data just for that tab.


    Some things I've tried that work for similar problems:

    I've figured out how to execute codebehind: I set the OnTabClick property of the RadTabStrip, and then in codebehind I check what tab was clicked.

    protected void tab_Click(object sender, RadTabStripEventArgs e)

    if (e.Tab.Text == "Info")

        { populateInfoTab();


    private void populateInfotab()


        // Do some stuff



    However, I can't figure out how to execute client side javascript after a specific tab is clicked. What I tried:
    Set OnClientTabSelected property, and then add some javascript:

    function tab_ClientClick(sender, args)


        var tab = args.get_tab();

        if(tab.get_text() == "Info")


           alert("Tab Clicked");



    This works, BUT:  

    The problem is that I need to set the InnerHtml of some div in the clicked pageview after it is clicked. I cannot do:

       some_div.InnerHtml = "test";

    after the alert.

    The div does not exist on page load (that specific RadPageView is hidden) so I cannot set it then. Once the user clicks into the tab, and after the page view loads, I need to be able to update the div's InnerHtml through JavaScript.
    How would I go about doing this?

  2. Ivan Danchev
    Ivan Danchev avatar
    1303 posts

    Posted 16 Sep 2015 Link to this post


    The text set to a div in a PageView not appearing after a postback/partial postback is expected. You can workaround this behavior by adding a HiddenField control on your page, which will hold the text value and you can use it to set the div's text after the page has loaded following a Tab click. You can do this the following way:
    • Set the text to the HiddenField's Value property in the OnClientTabSelecting or OnClientTabSelected event handler: $("#HiddenField1").val("New text");
    • Subscribe to the TabStrip's OnClientLoad event. It will fire after the TabStrip is loaded. Get the HiddenField value in its handler, set it to the div and set the HiddenField's value to an empty string:
    function OnClientLoad(sender) {
        if ($("#HiddenField1").val() != "") {

    Ivan Danchev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top