SelectGoodsFormData.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_SelectGoodsFormData : System.Web.UI.Page
  12. {
  13.     string TiaoJian = "";
  14.     BLL.UseThings BU = new BLL.UseThings();
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (!IsPostBack)
  18.         {
  19.             TiaoJian = "";
  20.             MyDataBind(1);
  21.             if (Request.QueryString["id"] != null)
  22.             {
  23.                 SelectedNodeChanged(Request.QueryString["id"].ToString());
  24.             }
  25.         }
  26.     }
  27.     /// <summary>
  28.     /// 获取信息
  29.     /// </summary>
  30.     public void MyDataBind(int pidx)
  31.     {
  32.         AspNetPager1.RecordCount = BU.GetCount(TiaoJian);
  33.         GridView1.DataSource = BU.GetPageList(10, pidx, "ID", false, TiaoJian);
  34.         GridView1.DataBind();
  35.     }
  36.     protected void SelectedNodeChanged(string GoodsId)
  37.     {
  38.         TiaoJian = "Id = " + GoodsId;
  39.         MyDataBind(1);
  40.     }
  41.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  42.     {
  43.         MyDataBind(e.NewPageIndex);
  44.     }
  45.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  46.     {
  47.         for (int i = 0; i < GridView1.Rows.Count; i++)
  48.         {
  49.             //首先判断是否是数据行
  50.             //if (e.Row.RowType == DataControlRowType.DataRow)
  51.             //{
  52.             //当鼠标停留时更改背景色
  53.             e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0FF';");
  54.             //当鼠标移开时还原背景色
  55.             e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  56.             //}
  57.         }
  58.     }
  59. }