views:

239

answers:

2

how can i set jquery tabs from my codebehind in page load of child page.

I tried setting tabs in initialization & then i am calling function from code behind to select the tab. but its not working at the first time. it works after postback.

$(function() {
    $('#tabsSelection').tabs();

    })

    function SelectTab() {
        $('#tabsSelection').tabs();
        $('#tabsSelection').tabs('select', 3);
    }

Code behind function to register script on page load

if (!IsPostBack)
    {
        ScriptManager.RegisterClientScriptBlock(Page, typeof(System.Web.UI.Page), "dsbl", "DisableTab();", true);
    }
A: 

This is just a guess, but try registring the JavaScript in Page_Init instead of Page_Load, and remove the check for IsPostPack:

protected void Page_Init(object sender, EventArgs e)
{
    ScriptManager.RegisterClientScriptBlock(Page, typeof(System.Web.UI.Page),
        "dsbl", "DisableTab();", true);
}
Jan Aagaard
A: 

Try placing DisableTab() function outside of

$(function(){...});

New Code:

$(function(){
  ...
});

function DisableTab(){
    ...
}

function SelectTab(){
    ...
}
jerjer