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

radgrid filtering

1 Answer 50 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Pallavi
Top achievements
Rank 1
Pallavi asked on 16 Nov 2011, 08:57 PM
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

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 18 Nov 2011, 10:38 AM
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
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Pallavi
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or