コード例 #1
0
ファイル: TabControl.ascx.cs プロジェクト: kudutest2/Kentico
    protected void Page_Load(object sender, EventArgs e)
    {
        BasicTabControlMenu.Tabs            = new string[TabItems.GetUpperBound(0) + 1, 4];
        BasicTabControlMenu.SelectedTab     = SelectedTab;
        BasicTabControlMenu.UseClientScript = true;
        string tabs = "";

        for (int i = 0; i < TabItems.GetUpperBound(0) + 1; i++)
        {
            //Creates list of all IDs from TabItems
            if (i > 0)
            {
                tabs += ", ";
            }
            tabs += "'" + TabItems[i, 1] + "'";

            BasicTabControlMenu.Tabs[i, 0] = TabItems[i, 0];
            string showId = "'" + TabItems[i, 1] + "'";

            //In on-click event we hide all tabs content at first. Then we show tab content corresponding to current TabItems item.
            string showTabContentScript = "hideAllTabs();showSelectedTab(" + showId + ");";//
            BasicTabControlMenu.Tabs[i, 1] = showTabContentScript;

            BasicTabControlMenu.Tabs[i, 2] = "#";
        }

        //Creates array of all IDs. We'll use it to hide all corresponding spans.
        Response.Write("<script> basicTabControlMenuTabs = new Array(" + tabs + "); </script>");
    }