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

Two Issues with Grid inside PanelBar (Promethues)

2 Answers 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Waleed Seada
Top achievements
Rank 2
Waleed Seada asked on 13 May 2008, 01:13 PM
Dear All,

I have a simple and strange situation here.
Issue #1:
======
Working Scenario:
I have a usercontrols with a panelbar on it, I placed RadGrid control as a item templet then I assign a SqlDatasource to that grid DatasourceID, when I run the app. everything was good as expected.

NonWorking scenario:
I remove the SqlDatasource from the grid property and I use the NeedDataSource event where I create the SqlDatasource and assign it to the grid DataSourceID property , "no records found"
I make an alternative for this which is, I define the SqlDatasource declaratively on the usercontrols and then assign it's ID to RadGrid with no luck.

What is the problem here.
Here is my code:
protected void NewsGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)  
        {  
            SqlDataSource1.Select(DataSourceSelectArguments.Empty);  
            (source as RadGrid).DataSourceID = SqlDataSource1.ID;  
              
            /*
            // Read connection from web.config
            ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"];
            try
            {
                // pass the values read to the datasource
                SqlDataSource sqlsource = new SqlDataSource();
                sqlsource.ConnectionString = settings.ConnectionString;
                sqlsource.ProviderName = settings.ProviderName;
                sqlsource.SelectCommand = "SELECT ID, Link, Location, TimeCaptured, Brief, SmallImage FROM NewsSnap";
                sqlsource.Select(DataSourceSelectArguments.Empty);
                (source as RadGrid).DataSourceID = sqlsource.ID;
            }
            catch(Exception ex)
            {
                // swallow for now
            }
            */ 

Issue #2:
The panelBar has two or more panelbar the panelbar property expand mode is Single and the first item is expand by default.
But the panel is not collapsing or closing at all, it is always expanded for all child items ...
here is the .aspx syntax:
<telerik:RadPanelBar ID="NewsPanel" runat="server" Width="100%" SkinID="PanelBar" ExpandMode="SingleExpandedItem">  
<CollapseAnimation Duration="100" Type="InSine" /> 
<ExpandAnimation Duration="100" Type="outsine" /> 
    <Items> 
        <telerik:RadPanelItem Value="PanelItemGrid" Text="Root RadPanelItem1" runat="server" PostBack="False" Expanded="true">  
            <ItemTemplate> 
                <telerik:RadGrid ID="NewsGrid" runat="server" SkinID="Grid" Width="100%" AllowPaging="True" AllowSorting="True" GridLines="None" OnNeedDataSource="NewsGrid_NeedDataSource" ShowFooter="True" ShowStatusBar="True">  
                    <MasterTableView AutoGenerateColumns="False">  
                        <RowIndicatorColumn Visible="False">  
                            <HeaderStyle Width="20px" /> 
                        </RowIndicatorColumn> 
                        <ExpandCollapseColumn Resizable="False" Visible="False">  
                            <HeaderStyle Width="20px" /> 
                        </ExpandCollapseColumn> 
                        <EditFormSettings> 
                            <PopUpSettings ScrollBars="None" /> 
                        </EditFormSettings> 
                        <PagerStyle Mode="NextPrevAndNumeric" /> 
                    </MasterTableView> 
                    <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">  
                        <Selecting AllowRowSelect="True" /> 
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
                    </ClientSettings> 
                </telerik:RadGrid> 
            </ItemTemplate> 
        </telerik:RadPanelItem> 
        <telerik:RadPanelItem Value="PanelItem2" Text="Root RadPanelItem2" runat="server" PostBack="False" Expanded="false">  
            <ItemTemplate> 
                <asp:Button runat="server" ID="button1" /> 
            </ItemTemplate> 
        </telerik:RadPanelItem> 
    </Items> 
</telerik:RadPanelBar> 

Hope that you can help me getting through...
Thanks and best regards,
Waleed

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 May 2008, 07:14 AM
Hi,

Go through the following help document link.
Programmatic creation

Princy.
0
Zyguy
Top achievements
Rank 1
answered on 09 Jul 2008, 03:23 PM
Just in case it helps anyone, I experienced problem #2 and for some reason the Panelbar expand/collapse behaviour turns out as expected, if you add an additional PanelbarItem level within each PanelbarItem.

So, instead of:
 <telerik:RadPanelBar runat="server" ID="RadPanelBar1" PersistStateInCookie="True" EnableEmbeddedSkins="false"  ExpandMode="MultipleExpandedItems"
 <Items> 
 <telerik:RadPanelItem Text="Root Panel Item" runat="server" Selected="true"
                 <ItemTemplate> 
                        <telerik:RadGrid ID="NewsGrid" runat="server" SkinID="Grid" Width="100%" AllowPaging="True" AllowSorting="True" GridLines="None" OnNeedDataSource="NewsGrid_NeedDataSource" ShowFooter="True" ShowStatusBar="True">   
                        <MasterTableView AutoGenerateColumns="False">   
                            <RowIndicatorColumn Visible="False">   
                                <HeaderStyle Width="20px" />  
                            </RowIndicatorColumn>  
                            <ExpandCollapseColumn Resizable="False" Visible="False">   
                                <HeaderStyle Width="20px" />  
                        </ExpandCollapseColumn>  
                            <EditFormSettings>  
                                <PopUpSettings ScrollBars="None" />  
                            </EditFormSettings>  
                            <PagerStyle Mode="NextPrevAndNumeric" />  
                        </MasterTableView>  
                        <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">   
                            <Selecting AllowRowSelect="True" />  
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />  
                        </ClientSettings>  
                    </telerik:RadGrid>  
                </ItemTemplate> 
</telerik:RadPanelItem> 
</items> 
</telerik:RadPanelBar> 

you use:
 <telerik:RadPanelBar runat="server" ID="RadPanelBar1" PersistStateInCookie="True" EnableEmbeddedSkins="false"  ExpandMode="MultipleExpandedItems"
 <Items> 
 <telerik:RadPanelItem Text="Root Panel Item" runat="server" Selected="true"
         <Items> 
              <telerik:RadPanelItem Value="Child Panel Item" runat="server"
                 <ItemTemplate> 
                        <telerik:RadGrid ID="NewsGrid" runat="server" SkinID="Grid" Width="100%" AllowPaging="True" AllowSorting="True" GridLines="None" OnNeedDataSource="NewsGrid_NeedDataSource" ShowFooter="True" ShowStatusBar="True">   
                        <MasterTableView AutoGenerateColumns="False">   
                            <RowIndicatorColumn Visible="False">   
                                <HeaderStyle Width="20px" />  
                            </RowIndicatorColumn>  
                            <ExpandCollapseColumn Resizable="False" Visible="False">   
                                <HeaderStyle Width="20px" />  
                        </ExpandCollapseColumn>  
                            <EditFormSettings>  
                                <PopUpSettings ScrollBars="None" />  
                            </EditFormSettings>  
                            <PagerStyle Mode="NextPrevAndNumeric" />  
                        </MasterTableView>  
                        <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">   
                            <Selecting AllowRowSelect="True" />  
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />  
                        </ClientSettings>  
                    </telerik:RadGrid>  
                </ItemTemplate> 
               </telerik:RadPanelItem> 
         </Items> 
</telerik:RadPanelItem> 
</items> 
</telerik:RadPanelBar> 


Why it works like this I don't know, whether it's hacky or incorrect, also unknown, however it resolved my issue. If I have a bunch of Radgrids in their own PanelBarItems, all panels are incorrectly expanded, unless I add the extra sub-PanelBarItem.    

Tags
Grid
Asked by
Waleed Seada
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Zyguy
Top achievements
Rank 1
Share this question
or