tags:

views:

108

answers:

2

I'm trying to page and sort my datagrid wich is inside a modalpopupextender but I can't page it in any way, already tried with , put the updatepanel inside, outside, in the middle (loL) and it does NOT work. modal popup does not get closed but the grid just dissapear. Code:

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
  BindData()
End If

End Sub Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click SqlServerDS.SelectCommand = "SELECT * FROM emp WHERE name LIKE '%" & txtSearchName.Text & "%'" BindData() End Sub Private Sub BindData() grdSearch.DataSource = SqlServerDS grdSearch.DataBind() End Sub

Private Sub grdBuscaPaciente_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles grdSearch.PageIndexChanging grdSearch.PageIndex = e.NewPageIndex BindData() End Sub

Inside the Designer, this is the code h:

<modalpopupextender>
</modalpopupextender>
<panel>
<updatepanel>
<gridview>
</gridview>
</updatepanel>
</panel>
A: 

If you are using the .NET AJAX toolkit, keep in mind that each time you click someting (paging, sorting, etc.), the page performs a postback, even if it looks AJAX-y. Meaning that you will need to rebind the data each time. Try removing the IfPostback in your page load and see what that does for you.

Tommy
A: 

Tommy is right, so what you just have to do is re-show the popup. After the BindData() in the PageIndexChanging event show the panel again with the Show() method of the popup extender.

This code is in c# but is pretty much the same.

gvHorarioPB.DataSource = (DataTable)Session["Prueba"];
gvHorarioPB.PageIndex = e.NewPageIndex;
gvHorarioPB.DataBind();

//mpePB is my modalpopupextender
this.mpePB.Show();
Claudia