一页上有两个SPGridView:排序问题 [英] Two SPGridView on one page: Sorting issue

查看:62
本文介绍了一页上有两个SPGridView:排序问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have two spgridviews on a page, in which if I sort the second grid it calls/triggers the sort event for the first grid instead of triggering it's own event. Same thing happens with other events also like RowDataBound, PageIndexChanging.

我尝试使用asp.net网格并测试了该方案,该工作按预期进行.我还尝试了sharepoint的列表视图Web部件,该测试用例也通过了.

I Tried using asp.net grid and tested the scenario, this worked as expected. I also tried with sharepoint's list view web-part, this test-case passed as well.

但是,当我在页面上一个接一个地添加两个自定义编码的Web部件(即A和B)时,我注意到,如果先添加网格A,然后再添加网格B,则始终会触发网格A的事件.对于第二秒添加的网格,永远不会触发 它会为第一个gridview的事件调用该事件,并引发错误.

but when I added two of my custom coded web-parts on the page one by one i.e., A and B, I noticed that if I add grid A first and then grid B, it always the triggers the events for grid A. The events for grid which was added second never gets triggered, instead it makes a call to the event for the first gridview's events and throws an error.

我尝试了一些研究并通过网络实施了该解决方案,即将代码放入OnPreRender()方法中,将网格绑定写入了overridechildcontrol()等中,但是到目前为止,它们都没有起作用.

I tried with some research and implemented the solution over the net i.e., putting the code in OnPreRender() method, writing the grid binding in overridechildcontrol() etc, but none of them worked so far.

有人可以帮忙吗?

谢谢.

推荐答案

请张贴您使用的详细代码段,并将排序代码放置在GridView_Sorting方法中:

Please post detailed code snippet you use and the sorting code should be placed in GridView_Sorting method:

请检查下面的演示以在GridView中进行排序:

Please check the demo below to do sorting in a GridView:

http://www.c -sharpcorner.com/UploadFile/b8e86c/pagination-sorting-and-filtering-in-spgridview/

谢谢

最好的问候


这篇关于一页上有两个SPGridView:排序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆