在asp.net的网格视图中检索值

问题描述:

在具有templateField的(C#ASP.NET)网格视图中,如果将EnableSortingAndPagingCallbacks设置为true,则会出现以下错误:

In a (C# ASP.NET) gridview with a templateField you will get the following error if you have EnableSortingAndPagingCallbacks set to true:

"Callbacks are not supported on TemplateField because some controls cannot update properly in a callback. Turn callbacks off on 'xxxxxx'"


在排序和分页期间避免回发是一个非常方便的功能.不能与templateFields一起使用. TemplateField.ValidateSupportsCallback()方法的标准实现是抛出NotSupportedException.经过大量的搜索之后,有些人建议人们简单地重写此方法,以在自定义组件中不执行任何操作.这真的是解决方案吗?它可以工作吗?如果可以,怎么办?还是有另一种方法实现TemplateField的回调?


Avoiding postback during sorting and paging is a pretty handy feature. Not beeing able to use this with templateFields is not. The standard implementation of the TemplateField.ValidateSupportsCallback() method is to throw a NotSupportedException. After doing a lot of googling some people suggest that one simply override this method to do nothing in a custom component. Is this really the solution? Does it work, and if so how? Or is there another way of implementing callback for a TemplateField?

嘿,曼尼什,

我想如果我正确理解了您的问题,几年前我就遇到了这个问题,下面的帖子对我有很大帮助.看看"Manoj Shukla"帖子中的第四条评论.在模板列中为控件设置唯一的ID可能会解决此问题.

http://www.c-sharpcorner.com/Forums/Thread/35301/
Hey Manish,

I guess if I understand your problem correctly, I faced this issues a couple years back and the following post really helped me. Take a look at the 4th comment in the post by "Manoj Shukla". Setting the unique IDs for the controls in template columns might solve this.

http://www.c-sharpcorner.com/Forums/Thread/35301/