当前位置: 代码迷 >> ASP.NET >> 哪位高手能帮小弟我看一上!返回值为空,咋回事啊
  详细解决方案

哪位高手能帮小弟我看一上!返回值为空,咋回事啊

热度:9391   发布时间:2013-02-25 00:00:00.0
谁能帮我看一下!!急!急!急!急!急!返回值为空,怎么回事啊?
我在一个页面里面这么写的:

JScript code
function dealSelectAccount(sender) {        var result = window.showModalDialog("ProjectTypeList.aspx", "", "dialogWidth:540px;dialogHeight:255px;dialogLeft:300px;dialogTop:250px;center:yes;help=no;resizable:no;status:no;scroll=yes");        alert(result);


然后我在新打开的页面里面这么写的:

C# code
protected void btn1_Click(object sender, EventArgs e)        {            for (int i = 0; i < this.treeList.Nodes.Count;i++ )            {                if(treeList.CheckedNodes[i].Checked==true)                {                    Session["ID"] = treeList.CheckedNodes[i].Value.ToString();                    Session["NAME"] = treeList.CheckedNodes[i].Text.ToString();                    string tmp = Session["NAME"].ToString();                    Response.Write(" <Script language='JavaScript'> window.opener=null;window.open('about:blank','_self');window.returnValue = '" + Session["NAME"].ToString() + "';window.close();</Script>");                    break;                }            }         }


问题在于alert(result);为空,怎么回事啊?


------解决方案--------------------------------------------------------
window.opener=null;window.open('about:blank','_self');

写这些无用的代码多此一举
------解决方案--------------------------------------------------------
C# code
页面B:点击B上的(html)img执行function RetrunVal()function RetrunVal(){    var obj = window.dialogArguments;                   obj.value1=document.form1.ddlB.value;                   window.returnValue = obj;                   window.close();}页面A:在页面A加入TextBox1function OpenDialog(Url){  var t1;var obj=showModalDialog(url,window,"dialogHeight:200px;dialogWidth:500px"); if(obj != undefined)          {              t1= obj.value1;              eval("form1.TextBox1.value='"+TextBox1Name+"'");              eval("form1.TextBox1.blur()");          }}
  相关解决方案