I have a web form with a couple of linkbuttons. The linkbuttons serve as tab selectors, clicking one will activate an associated panel. When a panel is selected I don’t want the user to select it again, clicking the linkbutton would be an unnecessary roundtrip. I can set the button’s enabled property to false but the now the button will be grayed out. But this does not fit the user’s impression of having precisely selected that tab.
Many asp.net controls have the AutoPostback property to disable an unintended postback. A linkbutton does not. But there is a very simple way to knock out postback with a snippet of script. This code does exactly what I want
LinkButton1.CssClass = “HighlitedTab”;
This also works for a hyperlink. But I do not see a meaningful use for it there. Yet.