简体   繁体   English

在Telerik RadGrid控件中对GridButtonColumn进行排序

[英]Sort a GridButtonColumn in a Telerik RadGrid control

I need to sort a GridButtonColumn in a C# asp.net project. 我需要在C#asp.net项目中对GridButtonColumn进行排序。

I've added the c# class listed in this thread 我添加了此主题中列出的c#类

http://www.telerik.com/community/code-library/aspnet-ajax/grid/filtering-and-sorting-for-gridbuttoncolumn.aspx http://www.telerik.com/community/code-library/aspnet-ajax/grid/filtering-and-sorting-for-gridbuttoncolumn.aspx

and I can't get it to work. 我无法让它发挥作用。 I get this 我明白了

The type or namespace name 'GridButtonColumn' could not be found 找不到类型或命名空间名称'GridButtonColumn'

Is there using directive that I need to add? 是否有使用我需要添加的指令?

The VB example uses Imports Telerik.WebControls . VB示例使用Imports Telerik.WebControls When I add using Telerik.WebControls; 当我using Telerik.WebControls;添加using Telerik.WebControls; I get this message 我收到这条消息

The type or namespace name 'WebControls' does not exist in the namespace 'Telerik' (are you missing an assembly reference?) 命名空间'Telerik'中不存在类型或命名空间名称'WebControls'(您是否缺少程序集引用?)


EDIT: 编辑:

I added the namespace and now I get this error 我添加了命名空间,现在我收到了这个错误

Unknown server tag 'telerik:GridButtonColumnWithFilteringSorting 未知的服务器标签'telerik:GridButtonColumnWithFilteringSorting

If you develop a web application project there is no app_code folder. 如果您开发Web应用程序项目,则没有app_code文件夹。 In this case you can just put the GridButtonColumnWithFiltering.cs file anywhere you want and register it like this: 在这种情况下,您可以将GridButtonColumnWithFiltering.cs文件放在任何您想要的位置,并将其注册为:

<%@ Register Assembly="YourAssemblyName" TagPrefix="custom" Namespace="GridButtonColumnWithFilteringSortingNS" %>

The GridButtonColumn exists in the namespace Telerik.Web.UI. GridButtonColumn存在于名称空间Telerik.Web.UI中。 Try changing the Imports directive in your VB code from 尝试更改VB代码中的Imports指令

Imports Telerik.WebControls

to

Imports Telerik.Web.UI

Response to Edit: 对编辑的回应:

GridButtonColumnWithFilteringSorting is the class name of the custom GridButtonColumn that the above article creates. GridButtonColumnWithFilteringSorting是上述文章创建的自定义GridButtonColumn的类名。 In order to help you with this we probably need to see your code/markup for the your site. 为了帮助您,我们可能需要查看您网站的代码/标记。 In the above article it registers the custom button column as 在上面的文章中,它将自定义按钮列注册为

<Register TagPrefix="custom" Namespace="GridButtonColumnWithFilteringSortingNS">

Did you do this in your markup file? 你在标记文件中这样做了吗? If so change any 如果是这样改变任何

<telerik:GridButtonColumnWithFilteringSorting .. >

to

<custom:GridButtonColumnWithFilteringSorting . . >

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM