radgrid filtering

Thread is closed for posting
2 posts, 0 answers
  1. Pallavi
    Pallavi avatar
    1 posts
    Member since:
    Nov 2011

    Posted 16 Nov 2011 Link to this post

    Hello,

    In my application i have one radgrid. By using this below code I am binding my grid

     

     

    <telerik:GridTemplateColumn HeaderText="Roles" UniqueName="Roles" AllowFiltering="true">

     

    <ItemTemplate>

    <asp:Label runat="server" ID="lblRoles"></asp:Label>

    </ItemTemplate>

    </telerik:GridTemplateColumn>

    and using the below code I am getting values to the labels
    protected void uiUserRoles_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)

    {

    if (e.Item is GridDataItem)
    {

    GridDataItem item = (GridDataItem)e.Item;

    AcsAuthorizationProvider.Entities.ApUser apUser = e.Item.DataItem as AcsAuthorizationProvider.Entities.ApUser;

    if (apUser != null && !string.IsNullOrWhiteSpace(apUser.UserName))

    {

    Label lblRoles = (Label)e.Item.FindControl("lblRoles");

    if (lblRoles != null)

    {

    AcsRoleProvider acsRoleProvider = new AcsRoleProvider();

    string[] roles = acsRoleProvider.GetRolesForUser(apUser.UserName);

     

    lblRoles.Text = string.Join(", ", roles);

     

    }

    }

    }

     

    }



    now I want to apply the filter for the roles column of radgrid.Please help to do that.

    Thanks
    Pallavi
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 18 Nov 2011 Link to this post

    Hello Pallavi,

    To be able to implement filtering for template columns, you need to set the DataField property of the template column to the field you want to use for filtering. Refer to the help article below for additional information:
    http://www.telerik.com/help/aspnet-ajax/grid-implementing-filtering-for-gridtemplatecolumns.html                

    Best wishes,
    Pavlina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top