It seems that for many years I have been doing the same task; but at present I am completely stuck in the simplest thing, and this caused mykite irritation.
I need to assign javascript to an ASP.Net link (or hyperlinks, it doesn't matter) Which seems simpler?
A billion times I did it with code like this
//lbHeader.Attributes.Add("onclick",
// string.Format("ToggleSelectionPopup('{0}');return false;", panelContainer.ClientID));
But that will not work. The HTML I get contains javascript: __ doPostback (blahblahblah) and ignores my onclick function of my client. Instead, the page shifts to postback when I click the button (even though the onclick function is correctly attached to the "view page source" HTML
I tried to apply some tricks and approaches, for example the following
1) to replace LinkButton with Hyperlink - the effect is the same, the page goes to "NavigateURL" when I click href.
2) in order to assign the “OnClientClick” properties in the declarative layout - the same effect, the page goes to the postback anyway and ignores the “onclick"
3) to assign "javascript: ToggleSelectionPopup (blahblahblah)" as a NavigateURL hyperlink and as a PostBackURL in a linkButton. Does not work and
None of the tricks helped. What am I doing wrong, any ideas?
I just need to get rid of the shitty server performance of this control, but how can I do this? Of course, I can do LiteralControl "manually", but I would not want to use such an approximate approach.
Help get a high rating