This is a migrated thread and some comments may be shown as answers.

Hide tab from tabstrip

1 Answer 331 Views
Grid
This is a migrated thread and some comments may be shown as answers.
lakmal
Top achievements
Rank 2
lakmal asked on 07 Oct 2009, 05:02 AM
Hi,

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?

lakmal

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 07 Oct 2009, 08:11 AM
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.
aspx:
<telerik:RadGrid ID="RadGrid1" runat="server" OnItemDataBound="RadGrid1_ItemDataBound" OnNeedDataSource="RadGrid1_NeedDataSource">                   
      <MasterTableView  DataKeyNames="Checked">  
               <NestedViewTemplate>   
                        <asp:Panel ID="Container" runat="server">   
                                <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="MultiPage1">   
                                   <Tabs>                                           
                                            <telerik:RadTab runat="server" PageViewID="pageview1" Selected="true" Text="Details1">   
                                            </telerik:RadTab>   
                                            <telerik:RadTab runat="server" PageViewID="pageview2" Text="Details2">   
                                            </telerik:RadTab>   
                                    </Tabs>   
                                 </telerik:RadTabStrip>   
                    ........  

c#:
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
            }     
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
lakmal
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Share this question
or