需要在webforms-ascx复选框单击事件上以特定方式激发事件

本文关键字:事件 方式激 webforms-ascx 复选框 单击 | 更新日期: 2023-09-27 18:20:52

我试图基本上同时激发两个事件,我需要按顺序进行,先是服务器方法,然后是客户端方法。我需要先运行服务器端事件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。

我们非常感谢任何建议/解决方案。

感谢

需要在webforms-ascx复选框单击事件上以特定方式激发事件

您需要在客户端获取此许可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);