Two Issues with Grid inside PanelBar (Promethues)

3 posts, 0 answers
  1. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 13 May 2008 Link to this post

    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:
    1 <telerik:RadPanelBar ID="NewsPanel" runat="server" Width="100%" SkinID="PanelBar" ExpandMode="SingleExpandedItem">  
    2 <CollapseAnimation Duration="100" Type="InSine" /> 
    3 <ExpandAnimation Duration="100" Type="outsine" /> 
    4     <Items> 
    5         <telerik:RadPanelItem Value="PanelItemGrid" Text="Root RadPanelItem1" runat="server" PostBack="False" Expanded="true">  
    6             <ItemTemplate> 
    7                 <telerik:RadGrid ID="NewsGrid" runat="server" SkinID="Grid" Width="100%" AllowPaging="True" AllowSorting="True" GridLines="None" OnNeedDataSource="NewsGrid_NeedDataSource" ShowFooter="True" ShowStatusBar="True">  
    8                     <MasterTableView AutoGenerateColumns="False">  
    9                         <RowIndicatorColumn Visible="False">  
    10                             <HeaderStyle Width="20px" /> 
    11                         </RowIndicatorColumn> 
    12                         <ExpandCollapseColumn Resizable="False" Visible="False">  
    13                             <HeaderStyle Width="20px" /> 
    14                         </ExpandCollapseColumn> 
    15                         <EditFormSettings> 
    16                             <PopUpSettings ScrollBars="None" /> 
    17                         </EditFormSettings> 
    18                         <PagerStyle Mode="NextPrevAndNumeric" /> 
    19                     </MasterTableView> 
    20                     <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">  
    21                         <Selecting AllowRowSelect="True" /> 
    22                         <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
    23                     </ClientSettings> 
    24                 </telerik:RadGrid> 
    25             </ItemTemplate> 
    26         </telerik:RadPanelItem> 
    27         <telerik:RadPanelItem Value="PanelItem2" Text="Root RadPanelItem2" runat="server" PostBack="False" Expanded="false">  
    28             <ItemTemplate> 
    29                 <asp:Button runat="server" ID="button1" /> 
    30             </ItemTemplate> 
    31         </telerik:RadPanelItem> 
    32     </Items> 
    33 </telerik:RadPanelBar> 

    Hope that you can help me getting through...
    Thanks and best regards,
    Waleed
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 May 2008 Link to this post

    Hi,

    Go through the following help document link.
    Programmatic creation

    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Zyguy
    Zyguy avatar
    23 posts
    Member since:
    Jan 2008

    Posted 09 Jul 2008 Link to this post

    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.    

Back to Top