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 pagin开发者_如何学Pythonation 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,
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();
}
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
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.
精彩评论