0

I am trying to basically fire 2 events at the same time, and I need this to happen in order, server method followed by the client method. I need the server side event oncheckedchanged to run first, followed by my client side event

OnClientClick=<%# "window.open('" + this.ResolveUrl("~/Reports/EncroachmentPermit.aspx") + "?pguid=" + Eval("GUID")  + "', '_blank')" %>/>

The way that this is supposed to work is that this the last step in a workflow, and business logic / data access happens first in the checkedchanged event, followed by an rdlc report being opened in a new tab for potential printing, and the new tab is the whole reason I need a client event. This code below was my initial approach.

<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>

What I get in this case is the oncheckedchanged is firing, but the OnClientClick is not.

I was able to get what I needed to sort of happen using a response.redirect on the server side at the end of the oncheckedchanged, but the problem with this is that it's not in a different tab. So that's no good.

I tried

Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('/Reports/EncroachmentPermit.aspx?pguid=' + CurrentPermitGuid, '_newtab');", true);

The problem here is that I'm not able to see the CurrentPermitGuid within the literal string.

Any suggestions/solutions are much appreciated.

Thanks

Chris
  • 81
  • 8

1 Answers1

0

Do you need to get this permit GUID on the client side?

Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", 
"window.open('/Reports/EncroachmentPermit.aspx?pguid=' + CurrentPermitGuid, 
'_newtab');", true);

If you had access to it on the server side, you could just build up the URL there:

Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow",
 "window.open('/Reports/EncroachmentPermit.aspx?pguid=" + CurrentPermitGuid + "', '_newtab');", true);
Paddy
  • 33,309
  • 15
  • 79
  • 114
  • I had access to it on the server side. I think I had a quote off between currentpermitguid and _newtab. Thanks for the help. – Chris Nov 05 '15 at 14:04