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

Problem with Hierarchy grid expanding

1 Answer 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hamza
Top achievements
Rank 1
Hamza asked on 28 Sep 2011, 06:00 AM
hi all :)

i have a problem with hierarchy grid expanding

I bound the master and detailed tables, but when I run my page, I can see only the master table, with expanding arrow, but no expanding happened

can you help me please, with this code ?

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<style type="text/css">
    .style1
    {
        width: 100%;
    }
    .style2
    {
        direction: rtl;
    }
</style>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" HorizontalAlign="NotSet"
    LoadingPanelID="RadAjaxLoadingPanel1">
    <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" GridLines="None"
        CellSpacing="0" AutoGenerateColumns="False" Style="direction: rtl" OnPreRender="RadGrid1_PreRender">
        <MasterTableView TableLayout="Fixed" DataKeyNames="News_ID" DataSourceID="SqlDataSource1"
            Width="1000px">
            <ItemTemplate>
                <table class="style1">
                    <tr>
                        <td class="style2">
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("NewsCategory_AvatarPath")%>'
                                Width="30%" Height="30%" />
                        </td>
                    </tr>
                    <tr>
                        <td class="style2">
                            <asp:Label runat="server" ID="lblNewsTitle" Text='<%# Eval("News_Title")%>' Font-Bold="true"
                                Font-Names="Tahoma" Font-Size="Small"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td class="style2">
                            <asp:Label runat="server" ID="lblNewsText" Text='<%# Eval("News_Text")%>' Font-Bold="false"
                                Font-Names="Tahoma" Font-Size="Small"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td class="style2">
                            <asp:Label runat="server" ID="lblNewsDate" Text='<%# Eval("News_Date")%>' Font-Bold="false"
                                Font-Names="Tahoma" Font-Size="X-Small"></asp:Label>   
                            <asp:Label runat="server" ID="lblNewsTime" Text='<%# Eval("News_Time")%>' Font-Bold="false"
                                Font-Names="Tahoma" Font-Size="X-Small"></asp:Label>
                        </td>
                    </tr>
                </table>
            </ItemTemplate>
            <CommandItemSettings ExportToPdfText="Export to PDF" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="News_Title" FilterControlAltText="Filter News_Title column"
                    HeaderText="أخبار شبكة شام" HeaderStyle-Font-Bold="false" HeaderStyle-Font-Names="Tahoma"
                    HeaderStyle-Font-Size="Small" SortExpression="News_Title" UniqueName="News_Title">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="News_Text" FilterControlAltText="Filter News_Text column"
                    SortExpression="News_Text" UniqueName="News_Text">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="News_Date" FilterControlAltText="Filter News_Date column"
                    SortExpression="News_Date" UniqueName="News_Date">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="News_Time" FilterControlAltText="Filter News_Time column"
                    SortExpression="News_Time" UniqueName="News_Time">
                </telerik:GridBoundColumn>
            </Columns>
  <DetailTables>
                <telerik:GridTableView CommandItemDisplay="Bottom" DataKeyNames="News_Notes.Note_ID, News_Notes.News_ID"
                    Width="100%"
                    DataSourceID="SqlDataSource2" AllowAutomaticInserts="true" >
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="News_Notes.News_ID" MasterKeyField="News.News_ID" />
                    </ParentTableRelation>
                  <ItemTemplate>
                        <table class="style1">
                            <tr>
                                <td class="style2">
                                    <asp:Label runat="server" ID="lblNewsTitle" Text='<%# Eval("User_Name")%>'
                                        Font-Bold="false" Font-Names="Tahoma" Font-Size="Small"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="style2">
                                    <asp:Label runat="server" ID="lblNewsText" Text='<%# Eval("Note_Text")%>'
                                        Font-Bold="false" Font-Names="Tahoma" Font-Size="Small"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="style2">
                                    <asp:Label runat="server" ID="lblNewsDate" Text='<%# Eval("Note_Date")%>'
                                        Font-Bold="false" Font-Names="Tahoma" Font-Size="Small"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                    <Columns>
                        <telerik:GridBoundColumn DataField="Note_ID" DataType="System.Int32" FilterControlAltText="Filter Note_ID column"
                            HeaderText="التعليقات" ReadOnly="True" SortExpression="Note_ID" UniqueName="Note_ID"
                            HeaderStyle-Font-Bold="false" HeaderStyle-Font-Names="Tahoma" HeaderStyle-Font-Size="Small">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Note_Text" FilterControlAltText="Filter Note_Text column"
                            SortExpression="Note_Text" UniqueName="Note_Text">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Note_Date" DataType="System.DateTime" FilterControlAltText="Filter Note_Date column"
                            SortExpression="Note_Date" UniqueName="Note_Date">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="User_Name" FilterControlAltText="Filter User_Name column"
                            SortExpression="User_Name" UniqueName="User_Name">
                        </telerik:GridBoundColumn>
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
            </NestedViewTemplate>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
        </HeaderContextMenu>
    </telerik:RadGrid>
</telerik:RadAjaxPanel>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="SELECT News.News_ID, News.News_CategoryID, News.News_AdminID,
News.News_Title, News.News_Text, News.News_Date, News.News_Time,
News.News_FlagIsActive, NewsCategories.NewsCategory_ID, NewsCategories.NewsCategory_AvatarPath
FROM News INNER JOIN NewsCategories ON News.News_CategoryID = NewsCategories.NewsCategory_ID
WHERE News.News_FlagIsActive='True'
Order BY News.News_ID DESC"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" SelectCommand="SELECT News_Notes.Note_ID, News_Notes.News_ID, News_Notes.User_ID,
    News_Notes.Note_Text, News_Notes.Note_Date, News_Notes.Note_Flag,
    UsersTable.User_ID AS Expr1, UsersTable.User_Name
    FROM News_Notes INNER JOIN UsersTable ON News_Notes.User_ID = UsersTable.User_ID
WHERE  News_Notes.Note_Flag = 'True'
Order BY News_Notes.Note_Date "></asp:SqlDataSource>


any one can help me please!

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 28 Sep 2011, 11:19 AM
Hello Hamza,

Do you have any calls to the DataBInd() method of RadGrid in code behind? If yes, try removing them and see if it makes any difference. You can also disable temporary ajax and make sure that no client or server errors are thrown before you enable it back.

Kind regards,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Hamza
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or