JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Link Buttons

Hyperlinks are fine, but as a programmer, you have relatively little control over what happens when the user clicks them, because the browser takes over. However, Visual Basic also provides link buttons, which look just like hyperlinks, but act like buttons, with both Click and Command events. When the corresponding hyperlink is clicked, you can take some action in code, not just have the browser navigate to a new page. For example, the LinkButtons example on the CD-ROM makes a label with a border visible when you click the link button, as you see in Figure 17.7.

Click To expand
Figure 17.7: Using a link button.

Link buttons are supported with HTML <a> elements, just as hyperlink controls are, but the code for link buttons is processed back at the server. Here's what the HTML for the link button you see in Figure 17.7 looks like:

<a id="LinkButton1" href="javascript:__doPostBack('LinkButton1','')"
style="Z-INDEX: 101; LEFT: 162px; POSITION: absolute; TOP: 75px">

And that's what the Web server controls we'll work with in this chapter look like. It's time to see more details now in the Immediate Solutions section of this chapter.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor