views:

458

answers:

3

Just a quick question for all of you guys.

I have a Grid View inside Update Panel. My Modal PopUp pulls this Panel up. I am good so far.

However when I try to do pagination on the popped up grid view, The page Posts Back.

Then the Modal PopUp disappears and so does my GridView.

When I click on mybutton again, It shows the Modal PopUp with Grid View and the Next Page Contents in Grid View.

Is there any way I can get this Grid View to do pagination without Postback and without losing Modal PopUp ?

Any Help would be greatly appreciated.

Thanks,

A: 

The page must post back each time you change the page of the GridView. However, you can emulate the desired functionality by hooking into the PageIndexChanged event of the GridView:

protected void GridView1_PageIndexChanged(object sender, EventArgs e)
{
    modalPopupExtender1.Show();
}
Matthew Jones
A: 

You should have this layout:

<ModalPopup>
   <UpdatePanel>
       <GridView>
   <UpdatePanel>
</ModalPopup>

That way your ModalPopup won't disappear, unless you have another an outer updatepanel, and that updatepanel is set to UpdateMode=Always

aquinas
I have ModalPopUpExtender and I do not see any UpdatePanel inside it. What I have is as follows: <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" > ....</ajaxToolkit:ModalPopupExtender> <asp:Panel ID="PolicyEffectedPanel" runat="server" Style="display: none" CssClass="modalPopup"> <asp:UpdatePanel ID="updtpnlBoard" runat="server" > <ContentTemplate> <asp:GridView ID="pnlPoliciesGridView" runat="server"> </asp:GridView> </ContentTemplate></asp:UpdatePanel> Any suggestions ??
That looks correct. Do you have another update panel that is a parent of your modal popup?
aquinas
A: 

the popup should only dissappear when CancelControlID/OkControlID are clicked. More than 1 update panels can be a bit trickier.

Are you handling the page change event.

Private Sub Grid_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles Grid.PageIndexChanging Grid.PageIndex = e.NewPageIndex Grid.SelectedIndex = -1 Grid.DataBind() End Sub

This is not important ( from the point of this question), but your change you updateMode to Conditional.

Shivendra