我用js弹出模式窗口 把值传给下个页面
document.getElementById("HiddenField1").value=proGuid;
proGuid=window.showModalDialog("editPro.aspx",proGuid,"dialogWidth:550px;dialogHeight:400px; status:0;");然后再editPro.aspx里的页面 用 <script type="text/javascript">
function getGuid()
{
var ProGuid=window.dialogArguments;
document.getElementById("HiddenField1").value=ProGuid;
alert(ProGuid);
}
</script>
</head>
<body onload=" return getGuid();" >
得到上个页面的值 放在隐藏域中,后台在根据这个隐藏域 写sql语句后台: protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
private void bind()
{
//form1.Attributes.Add("onload", "getGuid()");
if (Request.QueryString["proGuid"] != null)
{
this.proGuid = Request.QueryString["proGuid"].ToString();
DataTable pda = DAL.sqlHelp.ExecTable("select * from productTB where ProGuid='" + this.HiddenField1.Value + "'");现在问题来了,他每次都是先 执行 后台的 Page_Load 方法 随后再执行 前台的 onload()事件,这样我的隐藏域里的值 一直是为空值,求解决办法
document.getElementById("HiddenField1").value=proGuid;
proGuid=window.showModalDialog("editPro.aspx",proGuid,"dialogWidth:550px;dialogHeight:400px; status:0;");然后再editPro.aspx里的页面 用 <script type="text/javascript">
function getGuid()
{
var ProGuid=window.dialogArguments;
document.getElementById("HiddenField1").value=ProGuid;
alert(ProGuid);
}
</script>
</head>
<body onload=" return getGuid();" >
得到上个页面的值 放在隐藏域中,后台在根据这个隐藏域 写sql语句后台: protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
private void bind()
{
//form1.Attributes.Add("onload", "getGuid()");
if (Request.QueryString["proGuid"] != null)
{
this.proGuid = Request.QueryString["proGuid"].ToString();
DataTable pda = DAL.sqlHelp.ExecTable("select * from productTB where ProGuid='" + this.HiddenField1.Value + "'");现在问题来了,他每次都是先 执行 后台的 Page_Load 方法 随后再执行 前台的 onload()事件,这样我的隐藏域里的值 一直是为空值,求解决办法
{
this.proGuid = Request.QueryString["proGuid"].ToString();这两句话 忘记注释了, 主要是
DataTable pda = DAL.sqlHelp.ExecTable("select * from productTB where ProGuid='" + this.HiddenField1.Value + "'");
Request.QueryString
就用按钮执行数据绑定