Asp.net Disable postback LinkButton

Add fallowing code to your page_load HTML:

<asp:LinkButton ID="myLinkButton" runat="server" Text="Click Me"></asp:LinkButton>

Code:
protected void Page_Load(object sender, EventArgs e)
{
myLinkButton.Attributes.Add("onClick", "return false;");
}

Happy tips&tricks :)

Advertisements

Asp.net c# save scroll position when postback

this is the mana:
Page.MaintainScrollPositionOnPostBack Property

Msdn say  “gets or sets a value indicating whether to return the user to the same position in the client browser after postback. This property replaces the obsolete SmartNavigation property.When Web pages are posted back to the server, the user is returned to the top of the page. On long Web pages, this means that the user has to scroll the page back to the last position on the page.When the MaintainScrollPositionOnPostback() property is set to true, the user is instead returned to the last position on the page.”

Usage:
<asp:Page MaintainScrollPositionOnPostBack=”True|False” />

Or  you can add your web config like this for all pages
<system.web>
<pages validateRequest=”true”  maintainScrollPositionOnPostBack=”true”>
</system.web>

Important Note: There is also a problem with this . Does not work with other browsers except ie.

Source:
Happy codding !!