I would like to use the LinkButton Control because it has a 'click' event built in which can be used to add functionality to a page. Unfortunately the LinkButton insists on doing a postback every time it is clicked. Is there a way to avoid this?
public void displayTutorial_Click(object sender, System.EventArgs e)
{
if (lnkView.CommandName == "pdffile")
{
try
{
if (Page.IsPostBack)
{
Response.Write(string.Format("<script>window.open('{0}','_blank');</script>", "FileUploads/EpilepsyExpertMappingResults.pdf"));
}
}
catch (Exception ex)
{
ExceptionManager.Publish(ex);
}
}
}
in aspx page:
<asp:LinkButton ID="lnkView" runat="server" CommandName="pdffile" onclick="displayTutorial_Click" ForeColor="#2aa7f9">Click here</asp:LinkButton>