I have a problem in filtering

6 posts, 0 answers
  1. li bin
    li bin avatar
    9 posts
    Member since:
    Jul 2009

    Posted 07 Jul 2009 Link to this post

    Hello,
    I'm a beginner.
    I want to do the job of grid in Filtering Template Columns, like 'Custom TemplateColumn Country' , I have realize the picture and the word, but The drop-down menu can't do. when I copy the whole code,the error like the following:
    Server Error in '/Siemens.BPM.Profile.Website' Application.
    --------------------------------------------------------------------------------

    Parser Error
    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Unknown server tag 'custom:MyCustomFilteringColumn'.

    Source Error:


    Line 92:                         </telerik:GridBoundColumn>
    Line 93:                           
    Line 94:                   <custom:MyCustomFilteringColumn
    Line 95:                          DataField="PermissionsNo" HeaderText="PermissionsNo"
    Line 96:                             SortExpression="PermissionsNo"                          
     

    Source File: /Siemens.BPM.Profile.Website/Demobin/WebForm1.aspx    Line: 94


    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433


    here is my code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Siemens.BPM.Profile.Website.Demobin.WebForm1" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="custom" Namespace="Telerik.GridExamplesCS.Programming.FilteringTemplateColumns" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager" runat="server" />
        <div>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                <script type="text/javascript">
                function ShowEditForm(id, rowIndex)
                {
    //                var grid = $find("<%= RadGrid1.ClientID %>");
                    
                    var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                    grid.get_masterTableView().selectItem(rowControl, true);
                            
                    window.radopen("DemoPermissionEdit.aspx?PermissionsId=" + id, "UserListDialog");
                    return false;
                }
                function ShowInsertForm()
                {
                   window.radopen("DemoPermissionEdit.aspx", "UserListDialog");
                   return false;
                }
                function refreshGrid(arg)
                {
                 if(!arg)
                 {
                 $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");             
                    }
                    else
                    {
                 $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");             
                    }
                }
                function RowDblClick(sender, eventArgs)
                {
                 window.radopen("DemoPermissionEdit.aspx?PermissionsId=" + eventArgs.getDataKeyValue("PermissionsId"), "UserListDialog");
                }
                </script>
            </telerik:RadCodeBlock>
            
                <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                        <telerik:AjaxSetting AjaxControlID="RadGrid1">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
                </telerik:RadAjaxManager>
                <telerik:RadGrid
                    OnItemCreated="RadGrid1_ItemCreated"
                    ID="RadGrid1"
                    runat="server"
                    AllowPaging="True"
                    Width="97%"
                   OnNeedDataSource="RadGrid1_NeedDataSource"
                AllowFilteringByColumn="True" GridLines="None">
                    <PagerStyle Mode="NumericPages" />
                    <MasterTableView
                        AutoGenerateColumns="False"
                        DataKeyNames="PermissionsId"
                        ClientDataKeyNames="PermissionsId"
                        Width="100%"
                        CommandItemDisplay="Top"
                        PageSize="5">
                        <Columns>
                            <telerik:GridBoundColumn
                                DataField="PermissionsId"
                                HeaderText="PermissionsId"
                                ReadOnly="True"
                                SortExpression="PermissionsId"
                                UniqueName="PermissionsId">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn
                                DataField="PermissionsName"
                                HeaderText="PermissionsName"
                                SortExpression="PermissionsName"
                                UniqueName="PermissionsName">
                            </telerik:GridBoundColumn>
                              
                      <custom:MyCustomFilteringColumn
                             DataField="PermissionsNo" HeaderText="PermissionsNo"
                                SortExpression="PermissionsNo"                          
                             UniqueName="PermissionsNo" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" >
                             <ItemTemplate>
                             <img src='Image/<%# Eval("PermissionsNo") %>.gif' alt="" style="vertical-align:middle;margin-right:7px;"/><%# Eval("PermissionsNo")%>
                             </ItemTemplate>
                </custom:MyCustomFilteringColumn>                                           
                           <%--   <custom:MyCustomFilteringColumn
                             </custom:MyCustomFilteringColumn>
                             <telerik:GridBoundColumn
                                DataField="PermissionsNo"
                                HeaderText="PermissionsNo"
                                SortExpression="PermissionsNo"
                                UniqueName="PermissionsNo">
                            </telerik:GridBoundColumn>   --%>
                          
                            <telerik:GridTemplateColumn
                                UniqueName="TemplateEditColumn">
                                 <ItemTemplate>                               
                                    <asp:Image ID="EditLink" ImageUrl="../Images/Write2.gif"  runat="server" />
                                      <%--  <img src='Image/<%# Eval("PermissionsNo") %>.gif' alt="" style="vertical-align:middle;margin-right:7px;"/><%# Eval("PermissionsNo")%>     --%>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>

                        </Columns>
                        <CommandItemTemplate>
                            <a href="#" onclick="return ShowInsertForm();">Add New Record</a>
                        </CommandItemTemplate>
                    </MasterTableView>
                    <ClientSettings>
                        <Selecting AllowRowSelect="true" />
                        <ClientEvents OnRowDblClick="RowDblClick" />
                    </ClientSettings>
                </telerik:RadGrid>
                
                <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
                    <Windows>
                        <telerik:RadWindow ID="UserListDialog" runat="server" Title="Editing record" Height="400px"
                            Width="300px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" />
                    </Windows>
                </telerik:RadWindowManager>

        </div>
        </form>
    </body>
    </html>


  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Jul 2009 Link to this post

    Hi,

    For creating the CustomFilteringColumn, you have to add the code for inheriting from the GridTemplateColumn. I'm not sure if you have the code for inheriting your custom column but if you do not, then you may refer the following help document which explains more on this:
    Implementing filtering for template/custom columns

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. li bin
    li bin avatar
    9 posts
    Member since:
    Jul 2009

    Posted 08 Jul 2009 Link to this post

    I don't know how to add and where to add ,

    I have added a MyCustomFilteringColumn.cs , like follows:

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Telerik.Web.UI;
    using Siemens.BPM.Profile.Services;
    using Siemens.BPM.Profile.Entities;

    namespace Telerik.GridExamplesCS.Programming.FilteringTemplateColumns
    {
        public class MyCustomFilteringColumn : GridTemplateColumn
        {
            public string DataField
            {
                get
                {
                    object res = this.ViewState["_df"];
                    if (res != null)
                    {
                        return (string)res;
                    }

                    return String.Empty;
                }
                set
                {
                    this.ViewState["_df"] = value;
                }
            }

            protected override void SetupFilterControls(System.Web.UI.WebControls.TableCell cell)
            {
                base.SetupFilterControls(cell);
                cell.Controls.RemoveAt(0);
                cell.Controls.AddAt(0, new TextBox());
            }
            public override GridColumn Clone()
            {
                return base.Clone();
            }

            protected override string GetFilterDataField()
            {
                return this.DataField;
            }

            protected override void SetCurrentFilterValueToControl(TableCell cell)
            {
                base.SetCurrentFilterValueToControl(cell);
                if (this.CurrentFilterValue != "")
                {
                    (cell.Controls[0] as TextBox).Text = this.CurrentFilterValue;
                }
            }
            protected override string GetCurrentFilterValueFromControl(TableCell cell)
            {
                return (cell.Controls[0] as TextBox).Text;
            }
            public override bool SupportsFiltering()
            {
                return true;
            }
        }
    }


    but it doesn't run also.

  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 13 Jul 2009 Link to this post

    Hello,

    Attached to this message is a simple runnable application that demonstrates the needed approach. Please give it  a try and let me know if you need additional assistance. 

    Regards,
    Pavlina
    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.
  6. david
    david avatar
    6 posts
    Member since:
    Jun 2009

    Posted 01 Aug 2009 Link to this post

    Do you have a version in VB?  

    Telerik.GridExamplesCS.Programming.FilteringTemplateColumns


    thanks dave
  7. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 05 Aug 2009 Link to this post

    Hi David,

    You can use our online C# to VB.Net converter tool:
    http://converter.telerik.com/

    All the best,
    Pavlina
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017