Saturday, March 24, 2012

Paging and UpdatePanel

Hi,

If you look at this page you see an example of paging within an update panel which works well

http://mattberseth2.com/resizeable_gridview_columns/


The difference I have is I also have ajaxToolkit:HoverMenuExtender on my first column which popups 'Edit Details' text which takes you to a new page...

without any triggers on the updatepanel, my paging now works as the above example.. but when I use my hover menu and click on 'Edit Detail' I get the following error..


Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near '

to fix this error I use the following trigger on the updatepanel

<Triggers>
<asp:PostBackTrigger ControlID="GridView1" />
</Triggers>

now when I click on Edit Details it takes me to the new page as intended... but when I click on my paging buttons it doesnt work within the update panel it causes full page reload..

any ideas to get these two working together would be appreciated...


I have newver try that, I actually just added the GridView inside an UpdatePanel and seem to work really well


Hi,

Generally, I think implement it as Albert suggested should work.

If still not, please provide a simple repro that demonstrate the first problem(Sys.WebForms.PageRequestManagerParserErrorException: The messagereceived from the server could not be parsed. Common causes for thiserror are when the response is modified by calls to Response.Write(),response filters, HttpModules, or server trace is enabled. Details:Error parsing near ' ).


Hi,

simple repro.. would be to grab the example from the above link... and add following hovermenu to first column... add pagertemplate below...

paging works fine within the updatepanel

on clicking edit details you get the error as described in the first post...

to fix this error I use the following trigger on the updatepanel

<Triggers>
<asp:PostBackTrigger ControlID="GridView1" />
</Triggers>

but now the paging causes full page post back..

adding thelnkBtnRowEditDetail as a trigger as well dosent work as that gives a control id cant be found error.

 <asp:TemplateField ShowHeader="False"> <ItemTemplate> <asp:Panel CssClass="popupMenu" ID="PopupMenuCustomerName" runat="server"> <div class="popupMenuButtons"> <asp:LinkButton ID="lnkBtnRowEdit" SkinID="SmallTextPopUp" runat="server" CommandName="Edit" Text="Edit
</asp:LinkButton> <asp:LinkButton ID="lnkBtnRowEditDetail" SkinID="SmallTextPopUp" runat="server" CommandName="EditDetail" Text="Edit Detail"></asp:LinkButton> </div> </asp:Panel> <asp:Panel ID="PanelCustomerName" runat="server"> <asp:ImageButton ID="ImgButton" runat="server" AlternateText="Edit" ImageUrl="~/images/icon_edit.gif" CausesValidation="false" CommandName="" /> </asp:Panel> <ajaxToolkit:HoverMenuExtender ID="hme3" runat="Server" HoverCssClass="popupHover" PopupControlID="PopupMenuCustomerName" PopupPosition="Left" TargetControlID="PanelCustomerName" PopDelay="15"> </ajaxToolkit:HoverMenuExtender> </ItemTemplate> <EditItemTemplate> <asp:Panel CssClass="popupMenu" ID="PopupMenuCustomerName" runat="server"> <div class="popupMenuButtons"> <asp:LinkButton ID="lnkBtnRowUpdate" SkinID="SmallTextPopUp" runat="server" CommandName="Update" Text="Update"></asp:LinkButton><br /> <asp:LinkButton ID="lnkBtnRowCancel" SkinID="SmallTextPopUp" runat="server" CommandName="Cancel" Text="Cancel"></asp:LinkButton> </div> </asp:Panel> <asp:Panel ID="PanelCustomerName" runat="server"> <asp:ImageButton ID="ImgButton" runat="server" AlternateText="Update/Cancel" ImageUrl="~/images/icon_edit.gif" CausesValidation="false" CommandName="" /> </asp:Panel> <ajaxToolkit:HoverMenuExtender ID="hme3" runat="Server" HoverCssClass="popupHover" PopupControlID="PopupMenuCustomerName" PopupPosition="Left" TargetControlID="PanelCustomerName" PopDelay="15"> </ajaxToolkit:HoverMenuExtender> </EditItemTemplate> </asp:TemplateField>

 <PagerTemplate> <div class="item"> <div class="item_left"> <asp:Label ID="lblPageTxt" runat="server" SkinID="PageSmallText" EnableViewState="false" Text="Page" ></asp:Label> <asp:DropDownList ID="PageDropDownList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="PageDropDownList_SelectedIndexChanged" /> <asp:Label ID="lblOfTxt" runat="server" SkinID="PageSmallText" EnableViewState="false" Text="of"></asp:Label> <asp:Label ID="lbTotalPages" runat="server" SkinID="PageSmallText"></asp:Label> </div> <div class="item_right"> <asp:ImageButton ID="imgbtnFirst" runat="server" CommandName="Page" CommandArgument="First" ImageUrl="~/images/arrow_up.gif"></asp:ImageButton> <asp:ImageButton ID="imgbtnPrev" runat="server" CommandName="Page" CommandArgument="Prev" ImageUrl="~/images/arrow_left.gif"></asp:ImageButton> <asp:ImageButton ID="imgbtnNext" runat="server" CommandName="Page" CommandArgument="Next" ImageUrl="~/images/arrow_right.gif"></asp:ImageButton> <asp:ImageButton ID="imgbtnLast" runat="server" CommandName="Page" CommandArgument="Last" ImageUrl="~/images/arrow_down.gif"></asp:ImageButton> </div> <div class="clear"></div> </div> </PagerTemplate>

not using the hovermenu isnt really an option... as this functionality is consistent with the rest of the site... unless you have another idea for reproducing this functionality

first column of our gridviews are a basic icon image... with a hover menu that has 'Edit' which edits gridview inline 'Edit Details' which goes to a new page ... they also have 'Clone' which provides a modal popup and 'Create Link'/'Remove Link' and other such functionlaity... which is available from the gridview using the hovermenu.



Would you mind showing a repro that I can run directly?


Hi Paul

I looked at the example at

http://mattberseth2.com/resizeable_gridview_columns/

and it looks great.
Can you share your code?

Thanks

Shalom


there is example code on that link... http://mattberseth2.com/resizeable_gridview_columns/

No comments:

Post a Comment