store.aspx.cs
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:2k
源码类别:

OA系统

开发平台:

ASP/ASPX

  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 System.Data.SqlClient;
  12. public partial class web_pos_store : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             UrlList.DataKeyNames = new string[] { "id" };
  19.         }
  20.     }
  21.     protected void UrlList_RowDataBound(object sender, GridViewRowEventArgs e)
  22.     {
  23.         //行高亮
  24.         if (e.Row.RowType == DataControlRowType.DataRow)
  25.         {
  26.             string ip = Request.UserHostAddress;
  27.             string url = "";
  28.             SqlConnection conn = dbConnection.getConnection();
  29.             conn.Open();
  30.             string sql = "";
  31.             if (ip.Contains("10.100"))
  32.             {
  33.                 sql = "select internal_url from OA_POS_URL where id=" + UrlList.DataKeys[e.Row.RowIndex].Value.ToString();
  34.             }
  35.             else
  36.             {
  37.                 sql = "select url from OA_POS_URL where id=" + UrlList.DataKeys[e.Row.RowIndex].Value.ToString();
  38.             }
  39.             SqlCommand cmd = new SqlCommand(sql, conn);
  40.             url = cmd.ExecuteScalar().ToString();
  41.             conn.Close();
  42.             e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor; this.style.backgroundColor='#c8dafa';this.style.cursor='hand'");
  43.             e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
  44.             e.Row.Attributes.Add("onclick", "window.open('http://"+ url +"')");
  45.         }
  46.     }
  47. }