Tags: , , | Categories: SharePoint, Technical Posted by jasond727 on 8/18/2011 3:36 PM | Comments (0)

If you are using sorting and paging in a SPGridView needing to persist the ViewState can be necessary on postback.  I created a custom SPMenuField where cliient side scripts would change an SPListItem.  The menu column needed to update based on the changes to stay accurate.  If a custom sort had been performed once posted back the default sort would apply.  On the onclientscriptclick method after your first javascript method include:

"javascript:__doPostBack('" + SPGridView.ClientID + "', '');";

Utilizing this method performs a postback and tells the system the SPGridView that sent the postback and keeping the ViewState intact and updating the custom menus with required changes.

Add comment




biuquote
Loading