Show combobox on grid filter by id but display value

2 posts, 0 answers
  1. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 30 Jan 2012 Link to this post

    I have a radgrid which has a GridBoundCoulmn with a FilterTemplate.  In the Template I have ClientID and ClientName.  The ComboBox displays the Client names and when the user selects it filters based on the ClientID.  The issue I have is in order to get this to work I have to set the Bound Coulmns DataField to the ClientID, which means in the grid you see the ID and not the client name.  How do I display the Client Name in the grid.

    <telerik:GridBoundColumn SortExpression="ClientID" DataField="ClientID" HeaderText="Client Name"  >
      <FilterTemplate>
         <telerik:RadComboBox ID="RadComboBoxClientName" DataTextField="ClientName" DataValueField="ClientID"
                  AppendDataBoundItems="true" Width="150px" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ClientID").CurrentFilterValue %>'
                  runat="server" OnClientSelectedIndexChanged="ClientNameIndexChanged" Skin="Office2007">
         </telerik:RadComboBox>
         <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
             <script type="text/javascript">
                function ClientNameIndexChanged(sender, args) {                                                         
                  var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                  if (args.get_item().get_value() == 0) {
                     tableView.filter("ClientID", args.get_item().get_value(), "NoFilter");
                  }
                  else {
                     tableView.filter("ClientID", args.get_item().get_value(), "EqualTo");
                  }
                }
             </script>
         </telerik:RadScriptBlock>
     </FilterTemplate>
     <ItemStyle VerticalAlign="Top" />
    </telerik:GridBoundColumn>
  2. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 30 Jan 2012 Link to this post

    Nevermind, I figured it out.  I just added a BoundColumn that contained the ID and set display to False and it works fine.  THought of that idea about 5 min after my post.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top