页面A的Button1_OnClick事件通过以下语句打开了模式窗体页面B:
Response.Write("<script>var sPhotoUrl=window.showModalDialog('PhotoView.aspx','','dialogHeight:600px;dialogWidth:800px');alert(sPhotoUrl);</script>");页面B的imgbtnPhoto_Command事件获取控件参数并传回页面A中:
protected void imgbtnPhoto_Command(object sender, CommandEventArgs e)
{
string sComArg = e.CommandArgument.ToString();
Response.Write("<script>window.returnValue=<%=sComArg%>;window.close();</script>");
}运行提示"当前页面的脚本发生错误",我试过将页面B的imgbtnPhoto_Command事件中将回传值改为字符串,能通过运行,问题应该出现在将.net的变量在Response.Write("<script></script>")中赋给JS语句处,具体应该怎么修改?另,在模式窗体中如何调用主窗体的事件?先谢过回答的各位~
Response.Write("<script>var sPhotoUrl=window.showModalDialog('PhotoView.aspx','','dialogHeight:600px;dialogWidth:800px');alert(sPhotoUrl);</script>");页面B的imgbtnPhoto_Command事件获取控件参数并传回页面A中:
protected void imgbtnPhoto_Command(object sender, CommandEventArgs e)
{
string sComArg = e.CommandArgument.ToString();
Response.Write("<script>window.returnValue=<%=sComArg%>;window.close();</script>");
}运行提示"当前页面的脚本发生错误",我试过将页面B的imgbtnPhoto_Command事件中将回传值改为字符串,能通过运行,问题应该出现在将.net的变量在Response.Write("<script></script>")中赋给JS语句处,具体应该怎么修改?另,在模式窗体中如何调用主窗体的事件?先谢过回答的各位~
为什么在Cs页面要写成<%=sComArg%>;的方式阿?
谢谢3楼的提醒