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

Google-like filtering using Controll in aspx

2 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 07 May 2012, 08:13 AM
Hi everyone,
i'd like to use the Google-like filtering for Radgrid as shown in one of the examples:
Grid / Google-like Filtering
It uses a self created Custom-ControllColumn for that which is inheriting from GritTemplatecolumn.
The control is declared in code-behind and therefore also the grid is created in code-behind.
I've already a grid and its columns are defined in the aspx file.
As far as I know you shouldn't mix up the column-definition; either code-behind or static in the aspx.
I'd like to know if it is possible to define this control in a way that i can use it in the aspx.

How can I realize that?
What steps must be done to make the in CS written control available in the aspx-file?

Greetings,
Marcel

2 Answers, 1 is accepted

Sort by
0
Accepted
Richard
Top achievements
Rank 1
answered on 09 May 2012, 09:39 PM
Marcel:

You can implement the custom filtering column even when declaring your columns in the .aspx page by doing the following:

Add a <%@ Register TagPrefix="custom"...> tag at the top of the .aspx markup, in the same manner as this sample:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DemoReview.aspx.cs" Inherits="AJAX_Demo_Review.DemoReview" %>
<%@ Register TagPrefix="custom" Namespace="AJAX_Demo_Review" Assembly="AJAX_Demo_Review" %>

Declare the column for which you wish to implement the Google-like filtering as follows:
<%-- This is the RadControl Product Column--%>
<custom:MyCustomFilteringColumnCS DataField="Product"
    HeaderText="Product" Groupable="true"
    GroupByExpression="Product Group by Product" SortExpression="Product"
    ColumnEditorID="GridDropDownListColumnEditor1" >
    <itemtemplate>
                <asp:Label ID="lblProduct" runat="server"><%# Eval("Product") %></asp:Label>
            </itemtemplate>
    <edititemtemplate>
                <asp:DropDownList DataMember="Product" ID="dllProduct" runat="server" Text='<%# Bind("Product") %>'
                    SelectedValue='<%# DataBinder.Eval(Container.DataItem, "Product") %>'>
                    <asp:ListItem Value="" Text="-Set Product-" />
                    <asp:ListItem Value="Multiple" Text="Multiple" />
                    <asp:ListItem Value="Ajax" Text="Ajax" />
                    <asp:ListItem Value="AsyncUpload" Text="AsyncUpload" />
                    <asp:ListItem Value="Button" Text="Button" />
                    <asp:ListItem Value="BinaryImage" Text="BinaryImage" />
                    <asp:ListItem Value="Calender" Text="Calender" />
                  </asp:DropDownList>
            </edititemtemplate>
</custom:MyCustomFilteringColumnCS>

Modify the "MyCustomFilteringColumnCS.cs" file from the online demo to work for your application/data source and include a copy in the top level of your web application.

This works for me, although I did face some issues in getting the register tag to correctly reference the "MyCustomFilteringColumnCS.cs".

Hope this helps!
0
Marcel
Top achievements
Rank 1
answered on 14 May 2012, 03:10 PM
Hi jumpstart,
Thanks for your response.
Your soluion works perfectly!.

Thank you and Greetings,
Marcel
Tags
Grid
Asked by
Marcel
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Marcel
Top achievements
Rank 1
Share this question
or