This tutorial will demonstrate how to use a link button with ASP.NET 4.0 and C#.
What is a LinkButton?
A link button is a button that appears to be a hyperlink control, but still has the functionality of a button. Link buttons can be used in the scenario where you need to add functionality to a hyperlink.
Need help with cloud hosting? Try Server Intellect. We used them for our cloud hosting services and we are very happy with the results!
If you need to add the functionality to actually have the control link to another page, you can simply change the PostBackUrl to whatever URL you want to link to. Here is what my link button source looks like:
A link button is a button that appears to be a hyperlink control, but still has the functionality of a button. Link buttons can be used in the scenario where you need to add functionality to a hyperlink.
We chose Server Intellect for its cloud hosting, for our web hosting. They have managed to handle virtually everything for us, from start to finish. And their customer service is stellar.
Using the LinkButton
To demonstrate how to use a link button, we will need to create a simple web site. At this point, I have created a new ASP.NET Empty Web Site. To begin:
- Right click the project in your solution explorer.
- Select add new item...
- Select a web form.
- Name it 'Default.aspx'.
- Click add.
- Open Default.aspx up to design mode.
- Drag and drop a linkbutton onto the web form.
- Double click the linkbutton to generate the LinkButton1_Click event method.
Need help with cloud hosting? Try Server Intellect. We used them for our cloud hosting services and we are very happy with the results!
If you need to add the functionality to actually have the control link to another page, you can simply change the PostBackUrl to whatever URL you want to link to. Here is what my link button source looks like:
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click" PostBackUrl="http://www.serverintellect.com">LinkButton</asp:LinkButton> |
No comments:
Post a Comment