SelectMateril.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:3k
源码类别:

.net编程

开发平台:

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. using com.etong.DAL.FC;
  12. public partial class Workflow_SelectMateril : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             string strContent = Request.QueryString["StrE"];
  19.             string sFiled = "wz_id,wz_name,wz_spec";
  20.             string sTable = "material_name where ";
  21.             DataView dv = new DataView();
  22.             EtongFlyChouCode EFlyCode = new EtongFlyChouCode();
  23.             sTable = sTable + "wz_spec like '%" + strContent + "%'";
  24.             dv=EFlyCode.BStringSelect(sFiled, sTable, 2);
  25.             GridView1.DataSource = dv;
  26.             GridView1.DataBind();
  27.         }
  28.     }
  29.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  30.     {
  31.         if (e.Row.RowType == DataControlRowType.DataRow)
  32.         {
  33.             int iRow;
  34.             iRow = e.Row.DataItemIndex;
  35.             iRow = iRow % 2;
  36.             if (iRow > 0)
  37.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
  38.             else
  39.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
  40.             e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
  41.         }
  42.     }
  43.     protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
  44.     {
  45.         string sSelectedIndex;
  46.         int iSelectedIndex = 0;
  47.         sSelectedIndex = WZID.Value;
  48.         if (sSelectedIndex.Trim() == "" || sSelectedIndex == null)
  49.         {
  50.         }
  51.         else
  52.         {
  53.             try
  54.             {
  55.                 iSelectedIndex = Convert.ToInt32(sSelectedIndex);
  56.             }
  57.             catch
  58.             {
  59.                 iSelectedIndex = -1;
  60.             }
  61.             if (iSelectedIndex != -1)
  62.             {
  63.                 ImageButton imgbtselected;
  64.                 imgbtselected = this.GridView1.Rows[iSelectedIndex].FindControl("IB_Selected") as ImageButton;
  65.                 imgbtselected.Visible = false;
  66.             }
  67.         }
  68.         int i = GridView1.SelectedIndex;
  69.         WZID.Value = Convert.ToString(i);
  70.         ImageButton imgbt;
  71.         imgbt = this.GridView1.SelectedRow.FindControl("IB_Selected") as ImageButton;
  72.         imgbt.Visible = true;
  73.         this.GridView1.SelectedRow.HorizontalAlign = HorizontalAlign.Center;
  74.         WZValue.Value = this.GridView1.SelectedRow.Cells[2].Text;
  75.         //TB_SelectName.Value = this.GridView1.SelectedRow.Cells[1].Text;
  76.         //imgbt = this.GridView1.TemplateControl.FindControl("IB_Del") as ImageButton;
  77.     }
  78.     protected void OKConfirm_Click(object sender, ImageClickEventArgs e)
  79.     {
  80.         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.returnValue=" +WZValue.Value +";window.close();</script>");
  81.     }
  82. }