title: Add hyperlink dynamically to gridview
body: <p>I am generating gridview dynamically. Here is the code</p>
  
  <p>Design Code</p>
  
  <pre><code>&lt;asp:GridView Width="100%" CssClass="TTable" ID="MainGridView" OnDataBound = "OnDataBound" runat="server" AutoGenerateColumns="False" onrowdatabound="GridView_RowDataBound"&gt;
              &lt;Columns&gt;
              &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Code Behind :</p>
  
  <pre><code>private void createGridView(DataTable gridviewdt)
      {
          MainGridView.Columns.Clear();
          //Iterate through the columns of the datatable to set the data bound field dynamically.
          foreach (DataColumn col in gridviewdt.Columns)
          {
              //Declare the bound field and allocate memory for the bound field.
              BoundField bfield = new BoundField();
  
              //Initalize the DataField value.
              bfield.DataField = col.ColumnName;
  
              //Initialize the HeaderText field value.
              bfield.HeaderText = col.ColumnName;
  
              //Add the newly created bound field to the GridView.
              MainGridView.Columns.Add(bfield);
  
          }
  
      }
  
  // Bind Datatable to gridview
  MainGridView.DataSource = gridviewdt;
  MainGridView.DataBind();
  </code></pre>
  
  <p>In the above code, I would like to put hyperlink on particular columns data. If I put the hyperlink directly on the Datatable, then it shows it as it is without executing.</p>
  
  <pre><code>&lt;asp:LinkButton ID="LinkButton1" runat="server"&gt;LinkButton&lt;/asp:LinkButton&gt;
  </code></pre>
  
  <p>How can I add above link button on some gridview columns ?</p>