how to: get rid of __doPostBack from link buttons?
-
05-10-2019 - |
Question
for example:
this code:
<asp:LinkButton ID="SignInLinkButton" runat="server" CssClass="SignInLinkButton" TabIndex="3" OnClick="AuthorizeUser">SignIn</asp:LinkButton>
shows this as link in status bar:
javascript:__doPostBack('ctl00$ctl00$GlobalPageContentPlaceHolder$ManagePageContentPlaceHolder$SignInLinkButton','')
is there a chance o get rid of this ugliness? or is there a better way of doing this, that does not generate this insanity?
i searched, but did not find an answer, so links are also cool. thnx
Solution
Displaying Text in the Browser's Status Bar When Mousing Over a LinkButton
Basically you need to add onmouseover="window.status='text to display in status bar'; return true;"
and onmouseout ="window.status=''; return true;"
to the link. The article shows you how to do it, and even makes a custom control for you.
Alternatively, you can style a button to look like a link (if you just want to get rid of the text).
Here's one example of doing it, but there might be other methods.
OTHER TIPS
Do what Greg says, but also rename your contentplaceholders to make them smaller.
Those long names are prepended to the name of each control on the page. They take up bandwidth unnecessarily when you have a lot of controls.
I always name mine 3 letters long.