[英]Grouping problem with postback in SPGridview
I have a SPGridView with a custom CheckBox Template in it. 我有一个带有自定义CheckBox模板的SPGridView。 To access the value of the checkbox I have created the SPGridView in Page_Init method.
要访问复选框的值,我已经在Page_Init方法中创建了SPGridView。 It was working fine.
工作正常。 I also have grouping in the grid.
我在网格中也有分组。 It was working fine till I made any postback in the page.
一切正常,直到我在页面中进行了任何回发。 To overcome that I created my own custom GridView and overrided the LoadControlState event.
为了解决这个问题,我创建了自己的自定义GridView并覆盖了LoadControlState事件。 Now the problem is when I use this Custom Grid in my page the LoadControlState event occurs after the Init event and hence the grid doesnt render on the page.
现在的问题是,当我在页面中使用此自定义网格时,LoadControlState事件在Init事件之后发生,因此网格无法在页面上呈现。 When i keep it in Page_Load it works fine but my custom checkbox template creates a problem then.
当我将其保存在Page_Load中时,它工作正常,但是我的自定义复选框模板随后产生了问题。 How do I get both the custom Checkbox Template and grouping with postback in the SPGridview working properly???
如何在SPGridview中正常运行自定义复选框模板和带回发的分组?
Please help as this is really getting me stuck......... 请帮忙,因为这真的让我感到困惑……...
I solved the problem. 我解决了问题。 I had to clear my grid columns every time and add new columns in page load .
我每次必须清除网格列,并在页面加载中添加新列。 This way the SPGrid is working perfectly fine with grouping and custom template even on postback
这样,即使在回发时,SPGrid也可以与分组和自定义模板完美配合
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.