title: how to get selected column value or name from datagrid in asp.net using c#
body: <p>My code is like this : Now I have now idea how to get column name of selected row  </p>
  
  <pre><code>protected void gv_imageslist_RowUpdating(object sender, GridViewUpdateEventArgs e)
  {
          string status;
          string sts;
          int result;
          lblerror2.Text = "";
          //((label)gv.Rows.FindControl("lbl1")).Text;
  
          string str = gv_imageslist.c
  
          if (str  == "Status")
          {
              status = ((Label)gv_imageslist.Rows[e.RowIndex].FindControl("lbl_Status")).Text;
              Gm.Gallery_Id = Convert.ToInt32(gv_imageslist.DataKeys[e.RowIndex].Value.ToString());
              if (status == "True")
              {
                  Gm.Is_Active = false;
              }
              else
              {
                  Gm.Is_Active = true;
              }
              result = Gm.Change_Image_Status();
              if (result == 1)
              {
                  Build_ImageGalleryList();
              }
              else
              {
                  lblerror2.Visible = true;
                  lblerror2.Text = "Unable to Change Status !";
              }
          }
          else
          //------For Checking of cover pic
          {
              sts = ((Label)gv_imageslist.Rows[e.RowIndex].FindControl("lbl_Cover")).Text;
              Gm.Gallery_Id = Convert.ToInt32(gv_imageslist.DataKeys[e.RowIndex].Value.ToString());
  
              string sp = ((Label)gv_imageslist.Rows[e.RowIndex].FindControl("lbl_category_Id")).Text;
              Gm.Category_Id = Convert.ToInt32 (sp);
              if (sts == "False")
              {
                  Gm.Is_Cover = true;
              }
              else
              {
                  Gm.Is_Cover = false;
              }
              result = Gm.Change_Gallery_Cover();
              if (result == 1)
              {
                  Build_ImageGalleryList();
              }
              else
              {
                  lblerror2.Visible = true;
                  lblerror2.Text = "Unable To Change Cover Pic !!";
              }
          }
  
      }
  </code></pre>