为什么在分页SqlDataSource上清除FilterExpression. [英] Why On Paging SqlDataSource clear FilterExpression.

查看:106
本文介绍了为什么在分页SqlDataSource上清除FilterExpression.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应用FilterExpression值,但是当我想更改页面时,将清除过滤器.
我该怎么做才能避免这种情况?

我这样设置过滤器:

I apply FilterExpression values but when I want to change page the filter is cleared.
What can I do to avoid this?

I set filter this way:

SqlDataSource1.FilterExpression = "type= 10";  



GridView位于



The GridView is in

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
   <contenttemplate>
        MyGridView.
   </contenttemplate>


谢谢.

[edit]已添加代码块,忽略HTML ..."选项已禁用-OriginalGriff [/edit]


Thank you.

[edit]Code block added, "Ignore HTML..." option disabled - OriginalGriff[/edit]

推荐答案

我执行此变通办法并起作用:

点击事件发生后:
I do this Workaround and works:

on click event after:
{
   .....
   SqlDataSource1.FilterExpression = "some expression";
   ViewState.Add("filter", SqlDataSource1.FilterExpression);
 }
Page_Load {
    if (Page.IsPostBack) {
        if (ViewState["filter"] != null) {
            SqlDataSource1.FilterExpression = ViewState["filter"].ToString();
        }
    }
}


这篇关于为什么在分页SqlDataSource上清除FilterExpression.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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