I need to open 2 different pages in different tab on click of save button. In the button click event I have the below code. The code is working if there is only one script block. Tried appending the scripts together. That is also not working
string voucher= CreateVouchers(startDate, endDate, userID);
UcErr.GeneralMessage = "Submitted successfully.";
if (voucher== ""){
if (ddlLeaveType.SelectedValue == "1")
{
pageURL = "http://" + baseURL + "HR/Report1.aspx?LeaveID=" + LeaveID;
string script = "window.open('" + pageURL + "' ,'_blank');";
ScriptManager.RegisterClientScriptBlock(this,this.GetType(), "tab1", script, true);
}
string pageURLNew = "http://" + baseURL + "HR/Print1.aspx?LeaveID=" + LeaveID;
string scriptNew = "window.open('" + pageURLNew + "' ,'_blank')";
ScriptManager.RegisterClientScriptBlock(this,this.GetType(), "tab2", scriptNew, true);
}
2
Answers
As my save click function contains different function calls, RegisterClientScriptBlock is not working. So I resolved the issue using a jquery function
Added a div in aspx page
In the save button click
In js
**You can also append the urls and use it in single
ScriptManager.RegisterClientScriptBlock
Try this**
This also worked for me , I tried in updatepanel also