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

Expand item in radGrid not work ..How use that ?

2 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mehdi
Top achievements
Rank 1
Mehdi asked on 13 Jul 2012, 02:00 PM
Hello, I'm having problems with the use of 'RadGrid' item to 'expand'. I used as reference the telerik demo on this link -> http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx. Everything works, however when I click to enlarge the view of an item expand nothing is displayed. I do not understand why. Here is my code

<asp:Panel ID="panelMonitoringSuiviFormation" runat="server" Visible="false" Width="100%" Height="100%" >
            <div style="width:100%;height:30px"></div>
            <asp:Label ID="lbl_TitreSuiviDeFormation" runat="server" Text="<%$ Resources:IRM,global_title_MonitoringUserFormation %>" Font-Size="26px" ForeColor="#454545"  ></asp:Label>
            <div style="margin:0 auto;text-align:center;height:100%;width:100%;">
                <!-- Grid dataTemplate with sql server-->
                <telerik:RadGrid ID="gridMonitoringUserFormation" CssClass="monitorUserTable" runat="server"
                    AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"
                    AllowPaging="True" PageSize="15" GridLines="None" ShowGroupPanel="true"

                              OnItemCommand="RadGrid1_ItemCommand" OnPreRender="gridMonitoringUserFormation_PreRender" OnItemCreated="gridMonitoringUserFormation_ItemCreated" >

                    

 

<MasterTableView runat="server" ShowHeader="true" DataKeyNames="userID" AllowMultiColumnSorting="True"

 

GroupLoadMode="Server">

                            <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">
                                <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0">
                                    <Tabs>
                                        <telerik:RadTab runat="server" Text="Sales" PageViewID="RadPageView1">
                                        </telerik:RadTab>
                                        <telerik:RadTab runat="server" Text="Contact Information" PageViewID="RadPageView2">
                                        </telerik:RadTab>
                                        <telerik:RadTab runat="server" Text="Statistics Chart" PageViewID="RadPageView3">
                                        </telerik:RadTab>
                                    </Tabs>
                                </telerik:RadTabStrip>
                                <!-- Definiton multi-pages for extend view-->
                                <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
                                    <!-- Page extend 1 -->
                                    <telerik:RadPageView runat="server" ID="RadPageView1" BackColor="Black">
                                        <asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='Sous-page 1'
                                Visible="false" runat="server" />
                                        <telerik:RadGrid runat="server"></telerik:RadGrid>
                                    </telerik:RadPageView>
                                    <!-- Page extend 2 -->
                                        <telerik:RadPageView runat="server" ID="PageView2" Width="460px" BackColor="Blue">
                                            <asp:Label ID="Label2" Font-Bold="true" Font-Italic="true" Text='Sous-page 2'
                                Visible="false" runat="server" />
                                        </telerik:RadPageView>
 
                                    <!-- Page extend 3 -->
                                    <telerik:RadPageView runat="server" ID="RadPageView3">
                                    <asp:Label ID="Label3" Font-Bold="true" Font-Italic="true" Text='Sous-page 3'
                                Visible="false" runat="server" />
                                    </telerik:RadPageView>
                                </telerik:RadMultiPage>
 
                            </asp:Panel>
                        </NestedViewTemplate>
 
                        <Columns>
                            <telerik:GridBoundColumn SortExpression="lastName" HeaderText="Nom de famille" HeaderButtonType="TextButton"
                                DataField="lastName" UniqueName="lastName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="firstName" HeaderText="Prénom" HeaderButtonType="TextButton"
                                DataField="firstName" UniqueName="firstName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="login" HeaderText="Identifiant" HeaderButtonType="TextButton"
                                DataField="login" UniqueName="login">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="creationDate" DataFormatString="{0:MM/dd/yyyy}"
                                HeaderText="creationDate" HeaderButtonType="TextButton" DataField="creationDate" UniqueName="creationDate">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
                 
 
            </div>
        </asp:Panel>
And my c# code for databinding

string idUser = myPanelBar.SelectedItem.Value;
                //Load description User on radGrid
                myDataSql.connectionString = myConnectionString;
                myDataSql.SelectCommand = "SELECT * FROM [tblUser] WHERE userID = "+idUser.ToString()+"";
                myGrid.DataSource = myDataSql;
                myGrid.MasterTableView.DataSource = myDataSql;
                myGrid.MasterTableView.DataBind();
                myGrid.DataBind();
Thans a lots if you can help me ^^

2 Answers, 1 is accepted

Sort by
0
Mehdi
Top achievements
Rank 1
answered on 13 Jul 2012, 02:45 PM
And if i insert this code "HierarchyDefaultExpanded="true" to <masterTableView > all work . But why ?? i don't need show all items expandable on load ..
Thanks
Mehdi Bugnard

0
Mehdi
Top achievements
Rank 1
answered on 13 Jul 2012, 05:30 PM
I have resolved my problem ^^

i have changed this function :
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridNestedViewItem)
{
e.Item.FindControl("InnerContainer").Visible = ((GridNestedViewItem)e.Item).ParentItem.Expanded;
}
}


that it's

i have changed this function :
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridNestedViewItem)
{
e.Item.FindControl("InnerContainer").Visible = true;
}
}



Tags
Grid
Asked by
Mehdi
Top achievements
Rank 1
Answers by
Mehdi
Top achievements
Rank 1
Share this question
or