Protected Sub lnkContractors_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkContractors.Click
If Context.User.IsInRole("HOD") Then
lnkContractors.OnClientClick = "PopupCenter('Juniors.aspx', 'myPop1',820,500);"
ElseIf Context.User.IsInRole("Contractor") Then
lnkContractors.OnClientClick = "PopupCenter('Contractors.aspx', 'myPop1',820,500);"
End If
End Sub
There is a LinkButton located in the master page within an UpdatePanel. When clicking on the link button for the first time, the page refreshes but the popup window does not open. It requires a second click for the popup window to open.
function PopupCenter(pageURL, title, w, h) {
var left = (screen.width / 2) - (w / 2);
var top = (screen.height / 2) - (h / 2);
var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
}