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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Gridview selected row issue

Gridview selected row issue

Scheduled Pinned Locked Moved ASP.NET
helpquestion
4 Posts 3 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.
  • P Offline
    P Offline
    Priya Prk
    wrote on last edited by
    #1

    Hi All, Im trying to get the value of the selected row in my gridview: lblErrorImport.Text = gvColumns.SelectedRow.Cells[1].Text; Bud im getting this error: Object reference not set to an instance of an object. How can i fix this? Thanks.

    D E 2 Replies Last reply
    0
    • P Priya Prk

      Hi All, Im trying to get the value of the selected row in my gridview: lblErrorImport.Text = gvColumns.SelectedRow.Cells[1].Text; Bud im getting this error: Object reference not set to an instance of an object. How can i fix this? Thanks.

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Something is null. Debug and check. I guess it should be selected row.

      50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

      P 1 Reply Last reply
      0
      • P Priya Prk

        Hi All, Im trying to get the value of the selected row in my gridview: lblErrorImport.Text = gvColumns.SelectedRow.Cells[1].Text; Bud im getting this error: Object reference not set to an instance of an object. How can i fix this? Thanks.

        E Offline
        E Offline
        ESTAN
        wrote on last edited by
        #3

        Like d@nish is saying. verify if you have a selected row. if (gvColumns.SelectedRow.Count > 0) { lblErrorImport.Text = gvColumns.SelectedRow.Cells[1].Text; }

        1 Reply Last reply
        0
        • D dan sh

          Something is null. Debug and check. I guess it should be selected row.

          50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

          P Offline
          P Offline
          Priya Prk
          wrote on last edited by
          #4

          Hi D@nish, I checked it, nothing is null...don't know what the problem is here

          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