需要在 webforms ascx 复选框点击事件上以特定方式触发事件
Need to fire events in a specific way on a webforms ascx checkbox click event
我试图基本上同时触发 2 个事件,我需要按顺序发生,服务器方法后跟客户端方法。我首先需要将服务器端事件 oncheckedchanged 更改为 运行,然后是我的客户端事件
OnClientClick=<%# "window.open('" + this.ResolveUrl("~/Reports/EncroachmentPermit.aspx") + "?pguid=" + Eval("GUID") + "', '_blank')" %>/>
这应该是工作流程的最后一步,业务逻辑/数据访问首先发生在 checkedchanged 事件中,然后在新选项卡中打开 rdlc 报告以进行潜在打印,而新选项卡是我需要客户端事件的全部原因。
下面的代码是我最初的方法。
<td><asp:CheckBox ID="CheckBox_ApprovalProcessComplete" runat="server" Text="Approval Process Complete"
Enabled="false" AutoPostBack="true" oncheckedchanged="CheckBox_ApprovalProcessComplete_CheckedChanged" OnClientClick=<%# "window.open('" + this.ResolveUrl("~/Reports/EncroachmentPermit.aspx") + "?pguid=" + Eval("GUID") + "', '_blank')" %>/></td>
我在这种情况下得到的是 oncheckedchanged 正在触发,但 OnClientClick 没有。
我能够在 oncheckedchanged 结束时使用服务器端的 response.redirect 获得我需要的东西,但问题是它不在不同的选项卡中。所以这样不行。
我试过了
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('/Reports/EncroachmentPermit.aspx?pguid=' + CurrentPermitGuid, '_newtab');", true);
这里的问题是我无法在文字字符串中看到 CurrentPermitGuid。
非常感谢suggestions/solutions。
谢谢
您需要在客户端获取此许可 GUID 吗?
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow",
"window.open('/Reports/EncroachmentPermit.aspx?pguid=' + CurrentPermitGuid,
'_newtab');", true);
如果您可以在服务器端访问它,您可以在那里构建 URL:
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow",
"window.open('/Reports/EncroachmentPermit.aspx?pguid=" + CurrentPermitGuid + "', '_newtab');", true);
我试图基本上同时触发 2 个事件,我需要按顺序发生,服务器方法后跟客户端方法。我首先需要将服务器端事件 oncheckedchanged 更改为 运行,然后是我的客户端事件
OnClientClick=<%# "window.open('" + this.ResolveUrl("~/Reports/EncroachmentPermit.aspx") + "?pguid=" + Eval("GUID") + "', '_blank')" %>/>
这应该是工作流程的最后一步,业务逻辑/数据访问首先发生在 checkedchanged 事件中,然后在新选项卡中打开 rdlc 报告以进行潜在打印,而新选项卡是我需要客户端事件的全部原因。 下面的代码是我最初的方法。
<td><asp:CheckBox ID="CheckBox_ApprovalProcessComplete" runat="server" Text="Approval Process Complete"
Enabled="false" AutoPostBack="true" oncheckedchanged="CheckBox_ApprovalProcessComplete_CheckedChanged" OnClientClick=<%# "window.open('" + this.ResolveUrl("~/Reports/EncroachmentPermit.aspx") + "?pguid=" + Eval("GUID") + "', '_blank')" %>/></td>
我在这种情况下得到的是 oncheckedchanged 正在触发,但 OnClientClick 没有。
我能够在 oncheckedchanged 结束时使用服务器端的 response.redirect 获得我需要的东西,但问题是它不在不同的选项卡中。所以这样不行。
我试过了
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('/Reports/EncroachmentPermit.aspx?pguid=' + CurrentPermitGuid, '_newtab');", true);
这里的问题是我无法在文字字符串中看到 CurrentPermitGuid。
非常感谢suggestions/solutions。
谢谢
您需要在客户端获取此许可 GUID 吗?
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow",
"window.open('/Reports/EncroachmentPermit.aspx?pguid=' + CurrentPermitGuid,
'_newtab');", true);
如果您可以在服务器端访问它,您可以在那里构建 URL:
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow",
"window.open('/Reports/EncroachmentPermit.aspx?pguid=" + CurrentPermitGuid + "', '_newtab');", true);