web中的全局变量的使用

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using SqlConnect;

public class comman
{
    public static bool check1 = true;
    public static bool check2 = true;
    public static bool check3 = true;
}

public partial class Admin_MessageManage : System.Web.UI.Page
{

  void paixu(string aa,out bool check,bool ch)//将comman类中的变量以out的形式传进去,同时并将他的值传进去,以便在方法中对全局变量的值进行操作
    {
        check = ch;
        if (lb_currentpage.Text != "0")
        {
            int max = 10;
            int start = (int.Parse(lb_currentpage.Text) - 1) * max;
            if (check)
            {
                bd(start, max, " order by " + aa + " desc");
                check = false;
            }
            else
            {
                bd(start, max, " order by " + aa + " asc");
                check = true;
            }
        }
    }

  protected void Link_sex_Click(object sender, EventArgs e)
    {
        paixu("sex",out comman.check1,comman.check1);
    }

   protected void Link_date_Click(object sender, EventArgs e)
    {
        paixu("date",out comman.check2,comman.check2);
    }

}

转载于:https://www.cnblogs.com/doutian/archive/2012/10/11/2720544.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值