我的父窗口Default.aspx 用 var strUrl = "ProductUpdate.aspx?ID=" + itemID;
var returnValue = window.showModalDialog(strUrl, window, "resizable=no;dialogWidth:750px;dialogHeight:650px;status:no;help:no;"); 打开了一个子窗口当子窗口回传returnValue ="ok"时
在if (returnValue == "ok") {
// var btnSearch = document.getElementById("<%=Button1.ClientID %>");
// btnSearch.click();
return true;
}触发服务器控件 <asp:Button ID="Button1" runat="server" Text="查询" onclick="Button1_Click" /></td> ,我用这种方法不行,请问怎么写?很急,在线等
var returnValue = window.showModalDialog(strUrl, window, "resizable=no;dialogWidth:750px;dialogHeight:650px;status:no;help:no;"); 打开了一个子窗口当子窗口回传returnValue ="ok"时
在if (returnValue == "ok") {
// var btnSearch = document.getElementById("<%=Button1.ClientID %>");
// btnSearch.click();
return true;
}触发服务器控件 <asp:Button ID="Button1" runat="server" Text="查询" onclick="Button1_Click" /></td> ,我用这种方法不行,请问怎么写?很急,在线等
var btnSearch = document.getElementById("<%=Button1.ClientID %>");
btnSearch.click();是可以用的
这个是肯定是执行不到服务器端事件的。。你可以改种方法嘛 .cs文件Load事件中if(!string.IsNullOrEmpty(Requst["returnValue "]))
{
if(Requst["returnValue "] == "ok")
{
//点击事件中执行的代码
}
}
<asp:Button ID="Button1" runat="server" Text="查询" onclick="Button1_Click" OnClientClick="return jsFunctionToShowDlg();" />
你在Button1_Click里面写
Response.Write("xx")
看能打出吗
看错了把你JS代码,放在</body>标签之前
你的参数名是叫:returnValue?if(!string.IsNullOrEmpty(Requst["returnValue"])) 上面是不是多了个空格?
但是 public void Button1_Click(object sender, EventArgs e)
{
Response.Write("asdasdsa");
if (this.ddlProductLine.Text.Trim() == "please choose")
{
MorenBind(Convert.ToInt32(ViewState["PageIndex"]));
}
else
{
if (this.ddlProductLine.Text.Trim() == "please choose" && this.ddlSuppliers.Text.Trim() != "please choose")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择产品线');</script>");
}
else
{
if (this.ddlProductLine.Text.Trim() != "please choose" && this.ddlSuppliers.Text.Trim() == "please choose")
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择供应商');</script>");
}
else
{
Bind(Convert.ToInt32(ViewState["PageIndex"]));
}
} }
}
就不显示response里的内容了
如:$("#btnOK").click();要不要括号我不记得了,你试下就知道了