里面的UpdatePanel ASP.net的GridView分页doesin't工作 [英] ASP.net Gridview Paging doesin't work inside UpdatePanel

查看:143
本文介绍了里面的UpdatePanel ASP.net的GridView分页doesin't工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Altough问题在某种程度上类似于这已经问了很多次,但问题仍然没有解决。这里有一个问题: 我有包含在标签的容器AJAX控件本身就是一个UpdatePanel里面的GridView。 GridView的做工精良及其相应的方法准确地发射,但是当我启用分页,(如)在我点击第二页时,GridView隐藏自身。这里是我的 PageIndexChanging 方式:

Altough questions somehow similar to this have been asked for a number of times, but the question is still unsolved. Here is the question: I have a gridview which is contained in a tab container ajax control which itself is inside an updatepanel. Gridview works excellent and its corresponding methods are fired accurately, but when I enable paging, (e.g.) after I click on page 2, the gridview hides itself. here is my PageIndexChanging method:

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView1.PageIndex = e.NewPageIndex;        
    GridView1.DataBind();
    UpdatePanel2.Update();        
}

为什么分页导致GridView控件停止正常工作?我该怎么办?

Why paging causes gridview to stop working correctly? What can I do?

推荐答案

解决的办法是,你应该补充你的页面的索引改变时,用来填充gridview的数据集。通过这种方式,可以确保每一个单独的回发已引发的GridView的页号,结果将被填充。

The solution is that you should refill the dataset which is used to populate the gridview, each time your page index is changed. By this way, you could ensure that in each seperate postback which has been triggered by the gridview page number, results will be populated.

这篇关于里面的UpdatePanel ASP.net的GridView分页doesin't工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆