April 19, 2024

SamTech 365

PowerPlatform, Power Apps, Power Automate, PVA, SharePoint, C#, .Net, SQL, Azure News, Tips ….etc

ASP.net move to anchor location programatically

Hi guys,

 

If you also have the requirement to programatically go to an anchor location, you can use the following line of code

I had to use this, to go down in the page after the event page submit, to display automatically the search results and avoid the users scroll down to see the search results.

ClientScript.RegisterStartupScript(this.GetType(), "hash", "location.hash = '#ANCHORNAME';", true);

You should have at some point in your html code an anchor called ANCHORNAME