得不到的,asp.net里面隐藏的东西,在客户端不会被翻译成html的
所以隐藏的内容,只能在服务器上得到,客户端无法得到,服务器是通过用ViewState来保存所有控件的状态的。
你可以在服务端程序里把要得到的东西,放到一个隐藏域(hidden)里,然后在客户端用js取得
这是一个思路
所以隐藏的内容,只能在服务器上得到,客户端无法得到,服务器是通过用ViewState来保存所有控件的状态的。
你可以在服务端程序里把要得到的东西,放到一个隐藏域(hidden)里,然后在客户端用js取得
这是一个思路
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace JBInfoManage._2052.ASPX.Analy
{
/// <summary>
/// SignDts 的摘要说明。
/// </summary>
public class SignDts : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.DataGrid grd1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(this.Session["Admin"].ToString()=="True")
{
}
else
{
JBInfoBase.Security pS=new JBInfoBase.Security();
if(!pS.GetFunction(int.Parse(this.Session["EmpID"].ToString()),"Stu0001002"))//有没有删除的权限
{
this.Response.Redirect("../common/noroot.aspx");
}
}
if(!this.IsPostBack)
{
FillDataGrid(0);
}
}
private void FillDataGrid(int page)
{
JBInfoBase.SingMems pSM=new JBInfoBase.SingMems();
DataTable pDT=pSM.SignDts("");
this.grd1.DataSource=pDT;
this.grd1.CurrentPageIndex=page;
this.grd1.DataBind();
foreach(DataGridItem item in grd1.Items )
{
for(int i=1;i<grd1.Columns.Count;i++)
{ item.Cells[i].Attributes.Add("onclick","javascript:self.location.href='Sign.aspx?BillID="+ ((CheckBox)item.Cells[0].Controls[1]).ToolTip.ToString() +"'");
item.Cells[i].Attributes.Add("Style","cursor:hand;");
}
item.Attributes.Add("onmouseover","currentcolor=this.style.backgroundColor;this.style.backgroundColor='#b7c4e2'");
item.Attributes.Add("onmouseout","this.style.backgroundColor=currentcolor");
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.grd1.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.grd1_PageIndexChanged);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void grd1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
this.FillDataGrid(e.NewPageIndex);
}
}
}