Asp.net - 在会话中的网格视图 [英] Asp.net - grid view in a session
本文介绍了Asp.net - 在会话中的网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
i有一个网格视图,一些叫做按价格排序的按钮,按日期排序,...
当我搜索一个项目时在我的网格视图中使用这些按钮,它只能在第一页中工作。
当我切换时,例如,在第二页中,网格视图丢失了过滤搜索。
所以我想在会话中保存我的网格视图,可能会解决这个问题。
我尝试过的事情:
我的GridView:
Hi all ,
i have a grid view , some button called "order by price", "order by date", ...
when i search an item in my grid view with these button, it works but only in the first page.
when i switch, for example, in the second page, the grid view lost the filter search .
So i want save my grid view in a session, probably will fix this problem.
What I have tried:
My GridView :
<pre> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
Font-Names = "Arial" Caption = "Catalogo"
DataKeyNames="ID" DataSourceID="SqlDataSource1" AllowPaging="True"
BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px"
CellPadding="4" CellSpacing="2" ForeColor="Black" Height="100%"
Width="100%" AllowSorting="True"
PageSize="50">
<Columns>
实施会议:
Implementing Session :
<pre>Session("GridView1") = GridView1
推荐答案
似乎在数据绑定之前没有设置pageindex。
尝试设置pageindex在gridview_databinding事件中类似于数据绑定。
并在必要时调用数据绑定方法。
也尝试设置第一页上的会话中gridview的pageindex。
Hi,
It seems like the pageindex is not being set before databind.
try setting the pageindex in gridview_databinding event similar to databound.
and call databind method there if necessary.
also try setting the pageindex of the gridview from the session on first pageload.
这篇关于Asp.net - 在会话中的网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文