how to: get rid of __doPostBack from link buttons?
Asked Answered
I

2

6

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

Illaffected answered 28/5, 2010 at 15:16 Comment(0)
U
7

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.

Updo answered 28/5, 2010 at 15:20 Comment(2)
when you say "style a button to look like a link", do you mean use a <asp:Button instead of <asp:LinkButton? then this "__doPostBack" text would be gone?Illaffected
Yes, that's what I meant. You don't see anything when you hover over an asp:Button, and clicking it will still post back. Plus you have the benefit of not relying of javascript.Updo
M
2

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.

Misjoinder answered 28/5, 2010 at 15:47 Comment(1)
thnx for the name tip. i like to have these long names for development, but maybe they can be changed before deployment :)Illaffected

© 2022 - 2024 — McMap. All rights reserved.