Hide tab from tabstrip

2 posts, 1 answers
  1. lakmal
    lakmal avatar
    76 posts
    Member since:
    Jun 2009

    Posted 07 Oct 2009 Link to this post


    I have radgrid. Inside grid i have radtabstrip. And also i have table bool field called  NewDoc. When a newdoc= True i want hide 2nd tab of tabstrip.

    How can i do that?

  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Oct 2009 Link to this post

    Hello Galgodage,

    I suppose your TabStrip is placed inside a NestedViewTemplate in the grid. If so, then you can try out the following code to hide a tab in the RadTabStrip based on a field in the parent row. In the example below, I have set the boolean field as the DataKeyName of the MasterTableView.
    <telerik:RadGrid ID="RadGrid1" runat="server" OnItemDataBound="RadGrid1_ItemDataBound" OnNeedDataSource="RadGrid1_NeedDataSource">                   
          <MasterTableView  DataKeyNames="Checked">  
                            <asp:Panel ID="Container" runat="server">   
                                    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="MultiPage1">   
                                                <telerik:RadTab runat="server" PageViewID="pageview1" Selected="true" Text="Details1">   
                                                <telerik:RadTab runat="server" PageViewID="pageview2" Text="Details2">   

    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
            if (e.Item is GridNestedViewItem) 
                GridNestedViewItem nesteditem = (GridNestedViewItem)e.Item; 
                string strtxt = nesteditem.ParentItem.GetDataKeyValue("Checked").ToString(); 
                if (strtxt == "True"
                    ((RadTabStrip)nesteditem.FindControl("RadTabStrip1")).Tabs[1].Visible = false

Back to Top