C# 需要基于会话变量启用或禁用RadTabStrip中的选项卡
我正在与Telerik Rad controls合作,我试图找出在需要根据会话变量启用或禁用RadTabStrip中的选项卡时使用的正确方法。您可能会认为类似于C# 需要基于会话变量启用或禁用RadTabStrip中的选项卡,c#,asp.net,telerik,C#,Asp.net,Telerik,我正在与Telerik Rad controls合作,我试图找出在需要根据会话变量启用或禁用RadTabStrip中的选项卡时使用的正确方法。您可能会认为类似于RadTabStrip.Mytab.enabled=false,但您不能为选项卡分配单个ID。我已经通读了文档,但我似乎不知道如何在会话的基础上完成它 非常感谢您的帮助 // If the user is still in a session - Enable a certain Tab in the TabStrip
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>
第1步内容
第2步内容
别担心,伙计们
我似乎已经明白了。我可以使用选项卡的索引启用或禁用选项卡。我找到了正确的语法,并将其应用到会话检查循环中
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;