C# - Linkbutton with OnClick + href?

392 Views Asked by At

I do have a linkbutton and i want it to call an event on the .cs file (OnClick Event that do something).

BUT I also want to make this button moves the scroll to certain div after.

I can do:

<asp:LinkButton ID="LinkButton1" runat="server" OnClick="doSomething_Click">DoSomething!</asp:LinkButton>

And it does call the doSomething_Click event correctly.

OR I can do:

<asp:LinkButton ID="LinkButton1" runat="server" href=#MainDiv>DoSomething!</asp:LinkButton>

And it does scroll to the "MainDiv" after clicking.

But I can't do both! href=#MainDiv and OnClick="doSomething_Click"

0

There are 0 best solutions below