Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I want the page stop refresh after I click the button

<asp:LinkButton ID="btneqview" runat="server" Text='<%# Eval("CCSEQID")%>' OnClientClick="btneqview_Command" OnCommand="btneqview_Command" CommandArgument='<%# Eval("CCSEQID") %>'>

Code behind :

Protected Sub btneqview_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
     Dim eqid As String = e.CommandArgument.ToString()
     Dim url As String = "MasterlistEquipmentDetails.aspx"
     Dim s As String = "window.open('" & url & "?" & "eqid=" & eqid & "', 'popup_window', 'width=1150,height=650,left=10,top=10,resizable=no');"
     ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)
End Sub

However, whenever I press the button, the entire page gets refreshed.
Does anyone have a solution to this, or is it really impossible?

What I have tried:

Use !IsPostBack in Page_Load // but the page still refreshes completely. I don't want Page_Load to be called at all.
Posted
Updated 29-May-18 18:03pm
Comments
F-ES Sitecore 30-May-18 5:12am    
Look into the asp:UpdatePanel, that's a way of having individual components refresh without the whole page refreshing.

1 solution

Rather than making the button click event server-side you can make use of ajax calls.
When your button is
ASP.NET
runat="server"
then whenever you click the whole page life cycle is repeated and hence it feels, like a refresh because in reality, the page reloads.

You can search on CP for articles on ajax if you're not familiar with the term.
You can start here[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900