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

RadGrid in RadPanelBar not appearing

2 Answers 145 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 20 Aug 2014, 07:10 AM
My radgrid is inside the radpanelbar but it won't show up. When it is outside the radpanelbar in a different panel it works perfectly. What is going on? Is OnNeedDataSource not triggering correctly? I couldn't find the control in the code-behind to make it work.

<telerik:RadPanelBar ID="SectionDetailsPanelBar" runat="server" Width="100%">
                            <Items>
                                <telerik:RadPanelItem runat="server" Text="Section Details">
                                    <ContentTemplate>
                                        <asp:Panel ID="SectionDetailsPanel" runat="server" GroupingText="Add Pages/Section">
                                            <telerik:RadGrid ID="RadGridSectionDetails" runat="server" AllowAutomaticUpdates="True" DataSourceID="dsReportSectionDetail" OnItemCommand="RadGridSectionDetails_ItemCommand"  Width="100%">
                                <MasterTableView AutoGenerateColumns="False" DataKeyNames="ReportSectionID" DataSourceID="dsReportSectionDetail">
                                    <Columns>
                                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="MoveUp" FilterControlAltText="Filter columnDelete column" ImageUrl="~/Images/arrow_up24.png" UniqueName="columnMoveUp">
                                            <HeaderStyle Width="25px"></HeaderStyle>
                                        </telerik:GridButtonColumn>
                                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="MoveDown" FilterControlAltText="Filter columnEdit column" ImageUrl="~/Images/arrow_down24.png" UniqueName="columnMoveDown">
                                            <HeaderStyle Width="25px"></HeaderStyle>
                                        </telerik:GridButtonColumn>
                                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" FilterControlAltText="Filter columnEdit column" ImageUrl="~/Images/edit_2_24.png" UniqueName="columnEdit">
                                        </telerik:GridButtonColumn>
                                        <telerik:GridBoundColumn DataField="ReportSectionID" DataType="System.Guid" FilterControlAltText="Filter ReportSectionID column" HeaderText="ReportSectionID" ReadOnly="True" SortExpression="ReportSectionID" UniqueName="ReportSectionID" Visible="False">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="ReportPageID" DataType="System.Guid" FilterControlAltText="Filter ReportPageID column" HeaderText="ReportPageID" ReadOnly="True" SortExpression="ReportPageID" UniqueName="ReportPageID" Visible="False">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="SectionType" FilterControlAltText="Filter SectionType column" HeaderText="SectionType" ReadOnly="True" SortExpression="SectionType" UniqueName="SectionType" Visible="False">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="SectionName" FilterControlAltText="Filter SectionName column" HeaderText="Heading Name" SortExpression="SectionName" UniqueName="SectionName">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="SectionDescription" FilterControlAltText="Filter SectionDescription column" HeaderText="Heading Description" SortExpression="SectionDescription" UniqueName="SectionDescription">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="SectionHeader" FilterControlAltText="Filter SectionHeader column" HeaderText="SectionHeader" ReadOnly="True" SortExpression="SectionHeader" UniqueName="SectionHeader" Visible="False">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CustomTitle" FilterControlAltText="Filter CustomTitle column" HeaderText="Custom Title" SortExpression="CustomTitle" UniqueName="CustomTitle">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>                                       
                                        <telerik:GridTemplateColumn DataField="SectionHTML" FilterControlAltText="Filter SectionHTML column" HeaderText="Section HTML" UniqueName="SectionHTML">
                                            <ItemTemplate></ItemTemplate>
                                            <EditItemTemplate>
                                                <telerik:RadEditor ID="RadEditorSectionHTML" runat="server" Content='<% # bind("SectionHTML")%>' NewLineMode="P"></telerik:RadEditor>
                                            </EditItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridBoundColumn DataField="LineBreaksAfter" DataType="System.Int32" FilterControlAltText="Filter LineBreaksAfter column" HeaderText="Line Breaks After" SortExpression="LineBreaksAfter" UniqueName="LineBreaksAfter" MaxLength="2">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="DefaultData" FilterControlAltText="Filter DefaultData column" HeaderText="DefaultData" ReadOnly="True" SortExpression="DefaultData" UniqueName="DefaultData" Visible="False">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridCheckBoxColumn DataField="IncludeOnReport" DataType="System.Boolean" FilterControlAltText="Filter IncludeOnReport column" HeaderText="Include On Report" SortExpression="IncludeOnReport" UniqueName="IncludeOnReport">
                                        </telerik:GridCheckBoxColumn>
                                        <telerik:GridCheckBoxColumn DataField="ShowTitle" DataType="System.Boolean" FilterControlAltText="Filter ShowTitle column" HeaderText="Show Title" UniqueName="ShowTitle">
                                        </telerik:GridCheckBoxColumn>
                                        <telerik:GridBoundColumn DataField="Seq" DataType="System.Int32" FilterControlAltText="Filter Seq column" HeaderText="Seq" ReadOnly="True" SortExpression="Seq" UniqueName="Seq" Visible="False">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridCheckBoxColumn DataField="Deleted" DataType="System.Boolean" FilterControlAltText="Filter Deleted column" HeaderText="Deleted" ReadOnly="True" SortExpression="Deleted" UniqueName="Deleted" Visible="False">
                                        </telerik:GridCheckBoxColumn>
                                        <telerik:GridBoundColumn DataField="UpdateDate" DataType="System.DateTime" FilterControlAltText="Filter UpdateDate column" HeaderText="Update Date" ReadOnly="True" SortExpression="UpdateDate" UniqueName="UpdateDate" Visible="False">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="UpdateUser" FilterControlAltText="Filter UpdateUser column" HeaderText="Update User" ReadOnly="True" SortExpression="UpdateUser" UniqueName="UpdateUser" Visible="False">
                                            <ColumnValidationSettings>
                                                <ModelErrorMessage Text="" />
                                            </ColumnValidationSettings>
                                        </telerik:GridBoundColumn>
                                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" FilterControlAltText="Filter columnDelete column" ImageUrl="~/Images/symbol_delete24.png" UniqueName="columnDelete">
                                            <HeaderStyle Width="25px"></HeaderStyle>
                                        </telerik:GridButtonColumn>
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                                        </asp:Panel>
                                    </ContentTemplate>
                                </telerik:RadPanelItem>
                            </Items>
                        </telerik:RadPanelBar>

2 Answers, 1 is accepted

Sort by
0
Jason
Top achievements
Rank 1
answered on 20 Aug 2014, 07:26 PM
This is my code-behind in attempt to somehow assign a datasource via code behind hoping it would fix my problem

private void LoadSectionDetails(string claimantreportsectionID)
        {
            RadGrid sectionDetails = (RadGrid) SectionDetailsPanelBar.FindItemByValue("SectionDetailsPanel").FindControl("RadGridSectionDetails");
 
        }

Unfortunately, it doesn't find the radgrid control though I expect it to.
0
Bozhidar
Telerik team
answered on 22 Aug 2014, 11:06 AM
Hello,

I tested the described scenario locally, and the grid shows up fine. Here's the sample code that I tested with:

aspx:
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server"></telerik:RadScriptManager>
    <div>
 
            <telerik:RadPanelBar ID="SectionDetailsPanelBar" runat="server">
                <Items>
                    <telerik:RadPanelItem runat="server" Text="Section Details">
                        <ContentTemplate>
 
                            <telerik:RadGrid ID="RadGrid1" runat="server">
                            </telerik:RadGrid>
 
                        </ContentTemplate>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelBar>
 
    </div>
    </form>
</body>
</html>

C#:
using System;
using System.Linq;
using Telerik.Web.UI;
 
public partial class Temp_PanelBarGrid : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RadGrid grid = SectionDetailsPanelBar.Items[0].FindControl("RadGrid1") as RadGrid;
        grid.DataSource = "test";
    }
}

Please note that the PanelBar item is initially collapsed, and you have to click on it in order for it to expand and show the grid. If you want the grid to be initially visible, you can set Expanded="true" on the panel item.

Regards,
Bozhidar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PanelBar
Asked by
Jason
Top achievements
Rank 1
Answers by
Jason
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or