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

[Solved] How to filter a column of dropdowns in RadGrid

3 Answers 220 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kem Arda
Top achievements
Rank 1
Kem Arda asked on 07 Oct 2009, 07:18 AM
On my RadGrid have a column of DropDownLists. I use those DropDownLists to present the sting definitions(from another table) of foreign keys of the table to which i bound my RadGrid over my datasource. Such as:

<

telerik:GridTemplateColumn HeaderText="Sube" SortExpression="SubeId" UniqueName="SubeIdddl" AllowFiltering = "true" filterlistoptions="AllowAllFilters" >

 

 

<ItemTemplate >

 

 

<asp:DropDownList ID="DropDownList1" runat="server" DataValueField = "SubeID" DataTextField = "SubeAdi"

 

 

DataSourceID="MyDataSourceSubeler" SelectedValue='<%# Bind("SubeId") %>' Enabled = "false" Width = "200">

 

 

</asp:DropDownList>

 

 

</ItemTemplate>

 

 

<ItemStyle Width="200px"></ItemStyle>

 

 

</telerik:GridTemplateColumn>

However it throws a worktime error saying that: 

Microsoft JScript worktime error: Sys.WebForms.PageRequestManagerServerErrorException: Expression expected

How can i handle that? thanks...

 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Oct 2009, 12:19 PM
Hello Kem Arda,

Try setting the DataField of the TemplateColumn to the required datafield in the database and tehn try filtering. Check out teh example below:
aspx:
  <telerik:GridTemplateColumn DataField="FirstName" AllowFiltering="true" > 
       <ItemTemplate> 
             <asp:DropDownList ID="DropDownList1" DataSourceID="SqlDataSource1" DataTextField="FirstName" SelectedValue='<%#Bind("FirstName") %>' runat="server"
             </asp:DropDownList> 
       </ItemTemplate> 
  </telerik:GridTemplateColumn> 

Hope this helps..
Princy.
0
Kem Arda
Top achievements
Rank 1
answered on 08 Oct 2009, 08:54 AM
Hi Princy,

That only works when i enter an integer id of string definition which is retrieved from another table by a datasource. Namely when i enter "1" as id it  filters records that has "1" as id- let say "xxx" that has id "1". However what i wantto do is to type "xxx" in the filter box and filter records on the base of string definition not id itself. And string definitions of ids stored in another table in FK_PF relation and and retrive corresponding string definiton of each id by a datasource to which i bound my dropdown such as DataSourceID="MyDataSourceSubeler"

Thanks...
0
Princy
Top achievements
Rank 2
answered on 08 Oct 2009, 01:00 PM
Hi Kem Adra,

You could probably implement custom filtering to get the scenario that you require. Here are some help documents which could provide  some insights to get you started:
Operating with the FilterExpression of Telerik RadGrid manually
Implementing filtering for template/custom columns

Thanks
Princy.




Tags
Grid
Asked by
Kem Arda
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Kem Arda
Top achievements
Rank 1
Share this question
or