I have this LinkButton:
<asp:LinkButton ID="lbiOpen" runat="server" />
and my Code behind:
protected void Page_Load(object sender, EventArgs e)
{
lbiOpen.Attributes.Add("onclick", "javascript:window.location.href('New.aspx');");
}
If a user clicks on the LinkButton a popup should open. But it doesn't work. When I click on nothing happens.
When I Change window.location.href = window.open
it works, but it opens in another tab.
This works for me:
<asp:LinkButton ID="lbiOpen" runat="server">Example</asp:LinkButton>
protected void Page_Load(object sender, EventArgs e)
{
lbiOpen.Attributes.Add("onclick", "window.open('New.aspx', 'New Window', 'width=200,height=100')");
}