How to add link button in grid view in


If you want to add a link button in grid view (which can be used like navigation link to next form) but you actually don’t know how to insert that link button into grid view column. Then here an article to sort your problem

For this major requirement is to add a template column in your grid view, you can do this by both design view or with source view in visual studio.  

In source view you can use following code snippets.

 HTML |  copy code |? 
    <asp:LinkButton ID="Lnkbtn" runat="server" >Your_text</asp:LinkButton>

And after adding above script check following things must be done with that, these are:

  • Make sure grid view data source is bounded.
  • Set auto Generate column to false.
  • Open grid view task, and add hyperlink in new column.

Now using design view follow these steps

  • Using edit column option from the context menu and clicking smart tag and add template field
  • Add template field in selected field list.
  • Right click on grid view
  • Select edit template
  • Now drag-drop link button control from the tool menu to the grid.
  • Bind the property of link column field using data binding.

These steps will help you to add a link button in grid view and any thing you want to…  

 HTML |  copy code |? 

Leave a Comment

Your email address will not be published.