Search code examples
c#asp.nethttp-redirecthref

Redirecting and performing click event on other page with href using ASP .net


I had an anchor link that redirects to other page. But i also want to perform click function of C# after redirecting. My code:

Home.aspx

<a href='City.aspx' ><span>Test city</span></a>

City.aspx.cs

<asp:LinkButton ID="LinkButton1" class="linkbtn" runat="server" onclick="ClickEvent1">Test city</asp:LinkButton>

On clicking "Test City" of Home.aspx, i want to redirect to City.aspx and also perform ClickEvent1 automatically from Home.aspx without clicking it, after redirection.


Solution

  • I believe you can find a solution to the same issue here https://stackoverflow.com/a/20992925/2658953