title: How to create button column in radgrid dynamically in asp.net?
body: <p>How to create button column in radgrid dynamically in asp.net?</p>
  
  <p>I have a radgrid in My Page. I want to create button column in radgrid dynamically. I create columns and set command name for them.When I click on one of item and go to ItemCommand event , command name is null (""). Why command name is empty?</p>
  
  <p>I have a data table that contain 3 column.</p>
  
  <p>all columns the first , dynamically generate.</p>
  
  <pre><code>private void createColumnToGrid(DataTable dtData)
      {
          radGridTicketByFlagList.DataSource = new string[] { };
          radGridTicketByFlagList.Columns.Clear();
  
          for (int i = 0; i &lt; dtData.Columns.Count; i++)
          {
                  GridButtonColumn col = new GridButtonColumn();
                  col.ButtonType = GridButtonColumnType.LinkButton;
                  col.CommandName = "Total";
                  col.UniqueName = "TCFlag" + i;
                  col.HeaderText = dtData.Columns[i].ToString();
  
                  col.DataTextField = dtData.Columns[i].ToString();
  
                  radGridTicketByFlagList.Columns.Add(col);
  
          }
      }
  </code></pre>
  
  <p>Then fill data source of radgrid.</p>
  
  <pre><code>     private void FillRptTicketByFlagMonthList()
      {
  //........
           radGridTicketByFlagList.DataSource = new string[] { };
           DataTable dtTicketFlag= clsReportManager.GetRptTicketByFlag(); // fill data table
  
           radGridTicketByFlagList.DataSource = dtTicketFlag;
           radGridTicketByFlagList.DataBind();
  }
  </code></pre>
  
  <p>grid is generated. When I click on a item in grid (link button) , and go to ItemCommand event, e.CommandName is empty. Why??</p>
  
  <p>I want to When I click on item , do an action for me.</p>