Thursday 27 April 2017

Difference between LinkButton control and Hyperlink control in Asp.net

In this post, I will explain whats the difference between LinkButton control and Hyperlink control in Asp.net.

A purpose of LinkButton control and Hyperlink control in Asp.net is same. But there is a major difference between two- 
HyperLink Control will not PostBack web page to the server, It will simply post a request to the server for the URL you set as NavigateUrl. HyperLink control doesn't have the OnClick event.

LinkButton works exactly like a normal Button control but it looks like a HyperLink control, it will PostBack page to the server allowing to do server-side operations. LinkButton control has an OnClick event.

If we need to do any operation with data that's on the page, we will have to use a LinkButton control, but if we just need to redirect the user to somewhere else go for a HyperLink control.

0 comments:

Post a Comment

Please do not enter any spam link in the message box.