This is a migrated thread and some comments may be shown as answers.
Filtering a RadGrid with a RadPanelBar
1 Answer 30 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Mike asked on 14 Jul 2009, 08:58 AM

This is probably a stupid question and I am obviously missing something but I cannot seem to filter a grid from a panelbar. The panel bar is being populated by an sql datasource and this works fine, however getting the accompanying grid to list the appropriate item(s) from the database is causing me some confusion. I got this to work with a dropdownlist but the panelbar seems to be a different animal altogether. I have included the panelbar control and the grid control below. I have searched thoroughly through all forums and help documentation and can't find anything that offers some help here so any help with this would be much appreciated :)

The RadPanelBar:

<telerik:RadPanelBar runat="server" 
<asp:SqlDataSource ID="LayoutPanelDataSource" 
                                 ConnectionString="<%$ ConnectionStrings: [omitted] %>"
                                 SelectCommand="SELECT [HashTableID], [hashText], [sortOrder] FROM [tblHashTable] WHERE [Category] = 'Layouts' ORDER BY [sortOrder] ASC">

The RadGrid:

<telerik:RadGrid ID="LayoutGridDetails" 
    <PagerStyle Mode="NumericPages" />
    <MasterTableView TableLayout="Fixed">
            <b>LayoutId:</b><%# Eval("LayoutId")%>
            <br />
            <b>LayoutName:</b><%# Eval("LayoutName")%>
            <br />
            <b>LayoutDescription:</b><%# Eval("LayoutDescription")%>

<asp:SqlDataSource ID="LayoutGridDataSource" 
                                 ConnectionString="<%$ ConnectionStrings:[omitted] %>"
                                 SelectCommand="SELECT [LayoutId], [LayoutName], [LayoutDescription], [LayoutCategory] FROM [tblLayouts] WHERE [LayoutCategory] = @LayoutCategory">

        <asp:ControlParameter Name="LayoutCategory" PropertyName="DataTextField" ControlID="LayoutPanelBar" />

I want to be able to filter the records in the tblLayouts.LayoutCategory based on the DataTextField="hashText" selected in the RadPanelBar. The hashText field from tblHashTable is nvarchar(50) and the LayoutCategory from tblLayouts is the same so there is no problem here. The DataField="HashTableID" is an Int32.

Any advice here would be appreciated, thank you.


1 Answer, 1 is accepted

Sort by
Veselin Vasilev
Telerik team
answered on 16 Jul 2009, 01:08 PM
Hello Grant,

In the SelectParameters do not use the DataTextField because it will always return "hashText" but use the SelectedItem.Text field instead (it will return the real text of the selected item):

   <asp:ControlParameter Name="LayoutCategory" PropertyName="SelectedItem.Text" ControlID="LayoutPanelBar" /> 

Sincerely yours,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Asked by
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
Share this question