开发者

Jquery Tabs initialization from asp.net pageload

开发者 https://www.devze.com 2022-12-09 15:12 出处:网络
how can iset jquery tabs from my codebehind in page load of child page. I tried setting tabs in initialization & then i am calling function fro开发者_运维问答m code behind to select the tab. but

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 fro开发者_运维问答m 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);
    }


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);
}


Try placing DisableTab() function outside of

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

New Code:

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

function DisableTab(){
    ...
}

function SelectTab(){
    ...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消