Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. retrive gridview cell value

retrive gridview cell value

Scheduled Pinned Locked Moved C#
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jashimu
    wrote on last edited by
    #1

    Hi All, I need to retrive value of GridView slelected row cell value.

    If I click on button1 or Button2 I want to retrive value of a specefic cell value thanks,

    W 1 Reply Last reply
    0
    • J jashimu

      Hi All, I need to retrive value of GridView slelected row cell value.

      If I click on button1 or Button2 I want to retrive value of a specefic cell value thanks,

      W Offline
      W Offline
      walterhevedeich
      wrote on last edited by
      #2

      Add a CommandName property to your buttons like this.

      <asp:Button ID="Button1" runat="server" CausesValidation="false" Text="Edit" OnClick="Button1_Click" CommandName="Button1Command"/>

      And then handle the RowCommand event. See below

      protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
      {
      if (e.CommandName == "Button1Command")
      {
      int index = Convert.ToInt32(e.CommandArgument);
      GridViewRow row = GridView1.Rows[index];
      //From there, you can get the value of the cells from the row.
      }
      }

      Signature construction in progress. Sorry for the inconvenience.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups