禁用ASP.Net中的选项卡

时间:2012-01-13 20:56:10

标签: asp.net tabs

我们使用<li>来使用CSS控制Tab控件。

一旦渲染,我们就有了这个:

<div class="innertabs" id="tabbar">
<ul>
    <li id="ctl00_ContentPlaceHolderMain_SIS_ICMS_IntranetWeb_Modules_Person_TabCasePlanYJ_CasePlan_TabInterventionsYJ_liOrders" class="" disabled="disabled">
        <a id="ctl00_ContentPlaceHolderMain_SIS_ICMS_IntranetWeb_Modules_Person_TabCasePlanYJ_CasePlan_TabInterventionsYJ_lnkOrders" href="javascript:__doPostBack('ctl00$ContentPlaceHolderMain$SIS_ICMS_IntranetWeb_Modules_Person_TabCasePlanYJ_CasePlan$TabInterventionsYJ$lnkOrders','')">Orders</a>
    </li>
    <li id="ctl00_ContentPlaceHolderMain_SIS_ICMS_IntranetWeb_Modules_Person_TabCasePlanYJ_CasePlan_TabInterventionsYJ_liProgramActivityList" class="" disabled="disabled">
        <a id="ctl00_ContentPlaceHolderMain_SIS_ICMS_IntranetWeb_Modules_Person_TabCasePlanYJ_CasePlan_TabInterventionsYJ_lnkProgramActivityList" href="javascript:__doPostBack('ctl00$ContentPlaceHolderMain$SIS_ICMS_IntranetWeb_Modules_Person_TabCasePlanYJ_CasePlan$TabInterventionsYJ$lnkProgramActivityList','')">Program/activity list</a>
    </li>
    <li id="ctl00_ContentPlaceHolderMain_SIS_ICMS_IntranetWeb_Modules_Person_TabCasePlanYJ_CasePlan_TabInterventionsYJ_liProgramActivityDetail" class="current">
        <a id="ctl00_ContentPlaceHolderMain_SIS_ICMS_IntranetWeb_Modules_Person_TabCasePlanYJ_CasePlan_TabInterventionsYJ_lnkProgramActivityDetail" href="javascript:__doPostBack('ctl00$ContentPlaceHolderMain$SIS_ICMS_IntranetWeb_Modules_Person_TabCasePlanYJ_CasePlan$TabInterventionsYJ$lnkProgramActivityDetail','')">Program/activity details</a>
    </li>



</ul>

问题是,当我们将选项卡设置为禁用时,选项卡的文本(在您单击的实际选项卡位上)将被禁用 - 但仍然可以保持可点击状态。

我们正在尝试使用此代码:

private void TabCasePlanInterventionsProgramActivityDetails_OnCreateProgram()
    {
    //    ShowProgramActivityDetailPanel();
    //    TabCasePlanInterventionsProgramActivityList.Visible = false;
    //    TabCasePlanInterventionsProgramActivityDetail.Visible = true;
    //    liProgramActivityList.Disabled = true;
    //    liOrders.Disabled = true;

        ShowProgramActivityDetailPanel();
        TabCasePlanInterventionsProgramActivityList.Visible = false;
        TabCasePlanInterventionsProgramActivityDetail.Visible = true;
        TabCasePlanInterventionsOrders.Visible = false;
        //TabCasePlanInterventionsProgramActivityList.PopulateForm();

        liProgramActivityList.Attributes.Add("class", "");
        liProgramActivityDetail.Attributes.Add("class", "current");
        liOrders.Attributes.Add("class", "");
        liProgramActivityList.Disabled = true;
        liOrders.Disabled = true;


        if (CurrentAssessment!= null)
        {
            TabCasePlanInterventionsProgramActivityDetail.CurrentAssessment = CurrentAssessment; 
        }

        TabCasePlanInterventionsProgramActivityDetail.ChangeToCreateMode();   

        if (CurrentCasePlan!= null)
        {
            TabCasePlanInterventionsProgramActivityDetail.CurrentCasePlan = CurrentCasePlan;
            TabCasePlanInterventionsProgramActivityDetail.ChangeToCreateMode();   
        }
    }

有没有办法让它无法点击?

1 个答案:

答案 0 :(得分:2)

啊,列表项被禁用而不是子控件。

尝试循环使用liProgramActivityList的子控件,例如: liProgramActivityList.Controls并禁用所有这些。