store.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:2k
源码类别:
OA系统
开发平台:
ASP/ASPX
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- public partial class web_pos_store : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- UrlList.DataKeyNames = new string[] { "id" };
- }
- }
- protected void UrlList_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- //行高亮
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- string ip = Request.UserHostAddress;
- string url = "";
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- string sql = "";
- if (ip.Contains("10.100"))
- {
- sql = "select internal_url from OA_POS_URL where id=" + UrlList.DataKeys[e.Row.RowIndex].Value.ToString();
- }
- else
- {
- sql = "select url from OA_POS_URL where id=" + UrlList.DataKeys[e.Row.RowIndex].Value.ToString();
- }
- SqlCommand cmd = new SqlCommand(sql, conn);
- url = cmd.ExecuteScalar().ToString();
- conn.Close();
- e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor; this.style.backgroundColor='#c8dafa';this.style.cursor='hand'");
- e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
- e.Row.Attributes.Add("onclick", "window.open('http://"+ url +"')");
- }
- }
- }