簡體   English   中英

需要基於會話變量啟用或禁用RadTabStrip中的選項卡

[英]Need to enable or disable tabs in RadTabStrip based on a session variable

我正在使用Telerik Rad控件,當我需要基於會話變量啟用或禁用RadTabStrip中的選項卡時,我試圖找出正確的方法。 您可能會想像RadTabStrip.Mytab.enabled = false類的東西,但是您不能為這些標簽分配單獨的ID。 我已經閱讀了文檔,但似乎無法根據會話來確定如何進行操作。

任何幫助是極大的贊賞。

         // If the user is still in a session - Enable a certain Tab in the TabStrip and a certain PageView based on the current session variable.
        if (Session["PaymentStep"] != null)
        {
            switch (Session["PaymentStep"].ToString())
            {
                case "1":
                    // Need to select the "Bill" tab somehow and disable the rest
                    BillPayRadMultiPage.SelectedIndex = 0;
                    break;
                case "2":
                    // Need to select the "Provider" tab somehow and disable the rest
                    BillPayRadMultiPage.SelectedIndex = 2;
                    break;
                case "3":
                    // Need to select the "Payment" tab somehow and disable the rest
                    BillPayRadMultiPage.SelectedIndex = 3;
                    break;
                case "4":
                    // Need to select the "Confirmation" tab somehow and disable the rest
                    BillPayRadMultiPage.SelectedIndex = 4;
                    break;
                case "5":
                    // Need to select the "Reciept" tab somehow and disable the rest
                    BillPayRadMultiPage.SelectedIndex = 5;
                    break;
                default:
                    break;
            }
        }

到目前為止,這是我頁面中的內容

<!-- TabStrip -->
    <div class="BillPayWrapper">
        <telerik:RadTabStrip ID="BillPayNavigationRadTabStrip" SelectedIndex="0" runat="server" MultiPageID="BillPayRadMultiPage" Align="Justify"
            Skin="Silk" CssClass="tabStrip" CausesValidation="false">
            <Tabs>
                <telerik:RadTab runat="server" Text="Bill" PageViewID="Step1View"
                    ImageUrl="Images/1_normal.png"
                    SelectedImageUrl="Images/1_active.png" />
                <telerik:RadTab runat="server" Text="Provider" PageViewID="Step2View"
                    ImageUrl="Images/2_normal.png"
                    SelectedImageUrl="Images/2_active.png"
                    DisabledImageUrl="Images/2_disable.png" />
                <telerik:RadTab runat="server" Text="Payment" PageViewID="Step3View"
                    ImageUrl="Images/3_normal.png"
                    SelectedImageUrl="Images/3_active.png"
                    DisabledImageUrl="Images/3_disable.png" />
                <telerik:RadTab runat="server" Text="Confirmation" PageViewID="Step4View"
                    ImageUrl="Images/4_normal.png"
                    SelectedImageUrl="Images/4_active.png"
                    DisabledImageUrl="Images/4_disable.png" />
                <telerik:RadTab runat="server" Text="Reciept" PageViewID="Step5View"
                    ImageUrl="Images/5_normal.png"
                    SelectedImageUrl="Images/5_active.png"
                    DisabledImageUrl="Images/5_disable.png" />
            </Tabs>
        </telerik:RadTabStrip>

        <!-- MultiPage Container -->
        <telerik:RadMultiPage ID="BillPayRadMultiPage" runat="server" SelectedIndex="0"
            CssClass="multiPage" BorderWidth="1" BorderColor="#888888">

            <!-- Step 1 PageView -->
            <telerik:RadPageView ID="Step1RadPageView" runat="server">
                <h1>Step 1 Content</h1>
            </telerik:RadPageView>
            <!-- // Step 1 PageView -->

            <!-- Step 2 PageView -->
            <telerik:RadPageView ID="Step2RadPageView" runat="server">
                <h1>Step 2 Content</h1>
            </telerik:RadPageView>
            <!-- // Step 2 PageView -->

        <!-- You get the idea -->
        </telerik:RadMultiPage>

沒關系的人,

我似乎已經知道了。 我可以通過使用選項卡的索引來啟用或禁用這些選項卡。 我為此找到了正確的語法,並將其應用於我的會話檢查循環。

                    case "1":
                    BillPayNavigationRadTabStrip.Tabs[0].Enabled = true;
                    BillPayNavigationRadTabStrip.Tabs[0].Selected = true;
                    BillPayNavigationRadTabStrip.Tabs[1].Enabled = false;
                    BillPayNavigationRadTabStrip.Tabs[2].Enabled = false;
                    BillPayNavigationRadTabStrip.Tabs[3].Enabled = false;
                    BillPayNavigationRadTabStrip.Tabs[4].Enabled = false;
                    BillPayRadMultiPage.SelectedIndex = 0;
                    break;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM