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

automatic operations with custom filter template

0 Answers 24 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yotam
Top achievements
Rank 1
Yotam asked on 24 May 2012, 12:02 PM
Hi all
I have an issue while using automatic operations and filter template

I have a DropDownColumn on my grid and it has a custom filter
in order to use the filter expression, i have to bind the coloumn's DataField to the item.name
but when I perform auto insert/update - the datasource expects item.id to insert/update in the database

I've tried to change the filter's combo box to filter by value (which bound to the item.id) but it ignores it
I've tried to change all filter's combobox bindings to item.id but with no success either
i've tried using TemplateColumn but the result is the same


here is the code snippet: 

I'm using LinqDataSource to bind the grid and the ComboBoxes

The table Providers has:
name - Provider's name
id - Provider's id

The Table Contracts has
id - Contract's Id
name - Contract's name
ProviderID - foriegn key to Provider's id
ASPX
<telerik:GridDropDownColumn HeaderText="Provider" DataSourceID="ldsProviders" ListTextField="name"
    ListValueField="id" UniqueName="ContractProvider"
    DataField="ProviderID" AllowFiltering="true">
    <FilterTemplate>
     
    <telerik:RadComboBox ID="ddlFilterProviders"
    DataSourceID="ldsProviders"   
    DataTextField="name"
    DataValueField="name"
    AppendDataBoundItems="true"
    SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ContractProvider").CurrentFilterValue %>'
    runat="server"
    OnClientSelectedIndexChanged="SelectedIndexChanged"
    Filter="Contains">
    <Items><telerik:RadComboBoxItem/></Items></telerik:RadComboBox>
     
     
    <script type="text/javascript">
     
        function SelectedIndexChanged(sender, args) {
          var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
          tableView.filter("ContractProvider", args.get_item().get_value(), "EqualTo", true);
        
     
    </script>
    </FilterTemplate>
    </telerik:GridDropDownColumn>

thank you for your up coming answer

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Yotam
Top achievements
Rank 1
Share this question
or