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

Default expand

1 Answer 157 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paula
Top achievements
Rank 1
Paula asked on 16 Jul 2010, 05:11 PM
I have a very, very basic grid with a nestedviewtemplate and would like for it to be defaulted to be expanded.  I thought that was the default already but it isn't.  What am I doing wrong?

<MasterTableView AutoGenerateColumns="False" DataKeyNames="Main_Category_ID" 
            DataSourceID="sqlCatagoriesMain">
    <NestedViewTemplate>
        <asp:Label ID="lblMainID" runat="server" Text='<%# Eval("Main_Category_ID") %>' 
            Visible="False"></asp:Label>
        <asp:SqlDataSource ID="sqlCategoriesSub" runat="server" 
            ConnectionString="<%$ ConnectionStrings:BiddsConnectionString %>" 
            SelectCommand="SELECT * FROM [Categories_Sub] WHERE ([Main_Category_Link] = @Main_Category_Link) ORDER BY [Sub_Category]">
            <SelectParameters>
                <asp:ControlParameter ControlID="lblMainID" Name="Main_Category_Link" 
                    PropertyName="Text" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="False" 
            DataSourceID="sqlCategoriesSub" GridLines="None">
            <MasterTableView DataSourceID="sqlCategoriesSub">
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="Sub_Category_ID" UniqueName="column1" 
                        Visible="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Sub_Category" HeaderText="Category" 
                        UniqueName="column2">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Sub_Category_Desc" HeaderText="Description" 
                        UniqueName="column">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </NestedViewTemplate>
    <ExpandCollapseColumn  Visible="True">
    </ExpandCollapseColumn>
    <Columns>
        <telerik:GridBoundColumn DataField="Main_Category_ID" DataType="System.Int32" 
            ReadOnly="True" SortExpression="Main_Category_ID" UniqueName="Main_Category_ID" 
            Visible="False">
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn DataField="Main_Category" 
            HeaderText="Main_Category" SortExpression="Main_Category" 
            UniqueName="Main_Category">
            <EditItemTemplate>
                <asp:TextBox ID="Main_CategoryTextBox" runat="server" 
                    Text='<%# Bind("Main_Category") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="Main_CategoryLabel" runat="server" Font-Bold="True" 
                    Text='<%# Eval("Main_Category") %>'></asp:Label>
                   
                <asp:LinkButton ID="lbAddNew" runat="server" CssClass="toollink">Add New Category</asp:LinkButton>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridBoundColumn DataField="Main_Category_Desc" 
            HeaderText="Main_Category_Desc" SortExpression="Main_Category_Desc" 
            UniqueName="Main_Category_Desc" Visible="False">
        </telerik:GridBoundColumn>
    </Columns>
</MasterTableView>
</telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Jul 2010, 11:33 AM
Hello Paula,

You can expand the NestedViewTemplate by default, by setting HierarchyDefaultExpanded property of MasterTableView to 'True'.

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