SelectUserFormData.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:2k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. public partial class SelectForm_SelectUserFormData : System.Web.UI.Page
  12. {
  13.     /// <summary>
  14.     /// 模板 
  15.     /// </summary>
  16.     public Model.Users MU = new Model.Users();
  17.     /// <summary>
  18.     /// 业务
  19.     /// </summary>
  20.     public BLL.Users BU = new BLL.Users();
  21.     /// <summary>
  22.     /// 模板 
  23.     /// </summary>
  24.     Model.Department MD = new Model.Department();
  25.     /// <summary>
  26.     /// 业务
  27.     /// </summary>
  28.     BLL.Department BD = new BLL.Department();
  29.     /// <summary>
  30.     /// 查询条件
  31.     /// </summary>
  32.     public string TiaoJian = "";
  33.     protected void Page_Load(object sender, EventArgs e)
  34.     {
  35.         if (!IsPostBack)
  36.         {
  37.        
  38.             TiaoJian = "";
  39.             MyDataBind(1);
  40.         }
  41.         if (Request.QueryString["id"] != null)
  42.         {
  43.             SelectedNodeChanged(Request.QueryString["id"].ToString());
  44.         }
  45.     }
  46.     /// <summary>
  47.     /// 获取信息
  48.     /// </summary>
  49.     /// <param name="pidx">页号</param>
  50.     public void MyDataBind(int pidx)
  51.     {
  52.         AspNetPager1.RecordCount = BU.GetCount(TiaoJian);
  53.         GridView1.DataSource = BU.GetPageList(10, pidx, "ID", false, TiaoJian);
  54.         GridView1.DataBind();
  55.     }
  56.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  57.     {
  58.         MyDataBind(e.NewPageIndex);
  59.     }
  60.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  61.     {
  62.         for (int i = 0; i < GridView1.Rows.Count; i++)
  63.         {
  64.             //首先判断是否是数据行
  65.             //if (e.Row.RowType == DataControlRowType.DataRow)
  66.             //{
  67.             //当鼠标停留时更改背景色
  68.             e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0FF';");
  69.             //当鼠标移开时还原背景色
  70.             e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  71.             //}
  72.         }
  73.     }
  74.     protected void SelectedNodeChanged(string DeptId)
  75.     {
  76.         TiaoJian = "DeptId=" + DeptId;
  77.         MyDataBind(1);
  78.     }
  79. }