title: Merge Edit and Delete columns in one Column in Windows Forms using VS2010 , C# Code
body: <p><img src="https://i.stack.imgur.com/WGfSt.png" alt="enter image description here">I have one Edit column and another Delete column in a Windows DataGridView which I am binding programatically .. Say I have one column " Edit " and another " Delete " ,  which both are bound to "ID" .. Now I want to merge these both columns as " Edit/Delete" where there will be Links for " Edit " and "Delete " .. but as per VS Studio 2010's TableLayoutPanel  property of C# windows forms property , I can not have two controls in one Cell .. How to achieve this scenario using C# Windows Forms code </p>
  
  <p>Code :-</p>
  
  <pre><code>public frmTopicSectionManagement()
  
  {
  
  InitializeComponent();
  
  PopulateTopicList();
  
  PopulateGridView();
  
  }
  
  private void PopulateGridView()
  
  {
  
  try
  
  {
  
  string PYear = "";
  
  int pId;
  
  int TopicId = Convert.ToInt32(((Topiclist)cmbTopics.SelectedItem).TopicId);
  
  PYear = StartUp.PlanYear.ToString();
  
  pId = StartUp.ProductTypId;
  
  TopicSectionLookup objTopicSection = new TopicSectionLookup();
  
  if (repo.GetAllTopicSections() != null &amp;&amp; TopicId == -1 &amp;&amp; PYear != "")
  
  
    {
  
   GridView_TopicSection.DataSource = repo.GetAllTopicSectionDisplayTopicTitle(pId, PYear).ToList();                    GridView_TopicSection.Columns["ProductType"].Visible = false;
  
   GridView_TopicSection.Columns["Year"].Visible = false;                 
  PopulateAllGridView();
  
          }
      else if (repo.GetAllTopicSections() != null)
      {
      GridView_TopicSection.DataSource = repo.GetAllTopicsForSectionManagement(TopicId, pId, PYear).ToList();
                  GridView_TopicSection.Columns["ProductType"].Visible = false;
                  GridView_TopicSection.Columns["Year"].Visible = false;
                  PopulateAllGridView();
              }
              else
              {
                  return;
              }
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
                }
  
      private void PopulateAllGridView()
      {
          try
          {
              //Add Update Button to DataGridView(Problems here)
              if (!GridView_TopicSection.Columns.Contains("Update") || !!GridView_TopicSection.Columns.Contains("Delete"))
              {
                  DataGridViewLinkColumn updateColumn = new DataGridViewLinkColumn();
                  updateColumn.Name = "Edit";
                  updateColumn.HeaderText = "Update";
                  updateColumn.Text = "Edit";
                  updateColumn.Width = 50;
                  updateColumn.DividerWidth = 0;
                  updateColumn.UseColumnTextForLinkValue = true;
                  GridView_TopicSection.Columns.Add(updateColumn);
  
                  //  Add Delete Button to GridView (and here)
                  DataGridViewLinkColumn deletecolumn = new DataGridViewLinkColumn();
                  deletecolumn.Name = "Delete";
                  deletecolumn.HeaderText = "Delete";
                  deletecolumn.Text = "Delete";
                  deletecolumn.Width = 103;
                  deletecolumn.UseColumnTextForLinkValue = true;
                  GridView_TopicSection.Columns.Add(deletecolumn);
              }
  
              GridView_TopicSection.Columns["TopicId"].Visible = false;
              GridView_TopicSection.Columns["TopicSectionLookupId"].Visible = false;
              GridView_TopicSection.Columns["TopicTitle"].Visible = true;
              GridView_TopicSection.Columns["TopicTitle"].Width = 200;
              GridView_TopicSection.Columns["SectionText"].Visible = true;
              GridView_TopicSection.Columns["SectionText"].Width = 200;
              GridView_TopicSection.Columns["Year"].Visible = false;
              GridView_TopicSection.Columns["ProductTypeId"].Visible = false;
              GridView_TopicSection.Columns["IsActive"].Visible = true;
              GridView_TopicSection.Columns["IsActive"].Width = 80;
              GridView_TopicSection.Columns["IsBenifit"].Visible = true;
              GridView_TopicSection.Columns["IsBenifit"].Width = 80;
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
  
      }
  </code></pre>