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. Web Development
  3. ASP.NET
  4. Getting the Databound object out from a GridView

Getting the Databound object out from a GridView

Scheduled Pinned Locked Moved ASP.NET
3 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.
  • B Offline
    B Offline
    boy pockets
    wrote on last edited by
    #1

    Hello, I am using a GridView in combination with an ObjectDataSource. What I am after is a method to call (eg, after the row has been edited), which will return the values bound to the DataObject (i.e. the object that was passed in, or the object that is defined by the ObjectDataSource.DataObjectTypeName property). Currently, such a method is available when hooking into the RowDataBound action. The property GridViewRowEventArgs.Row.DataItem returns the values that have been bound as a DataObject. I would like to be able to call such a method when I am responing to postbacks (ie, from a button). I have looked at GridView.Rows[_index_].DataItem, but that always seems to be null. Any hint in right direction is appreciated. Cheers

    D I 2 Replies Last reply
    0
    • B boy pockets

      Hello, I am using a GridView in combination with an ObjectDataSource. What I am after is a method to call (eg, after the row has been edited), which will return the values bound to the DataObject (i.e. the object that was passed in, or the object that is defined by the ObjectDataSource.DataObjectTypeName property). Currently, such a method is available when hooking into the RowDataBound action. The property GridViewRowEventArgs.Row.DataItem returns the values that have been bound as a DataObject. I would like to be able to call such a method when I am responing to postbacks (ie, from a button). I have looked at GridView.Rows[_index_].DataItem, but that always seems to be null. Any hint in right direction is appreciated. Cheers

      D Offline
      D Offline
      Dave Sexton
      wrote on last edited by
      #2

      Although I'm not entirely certain have a look at the ObjectDataSource's OnUpdated event. There should be arguments passed to that to allow you retrieve the data.

      But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
      Because programming is an art, not a science. Marc Clifton

      1 Reply Last reply
      0
      • B boy pockets

        Hello, I am using a GridView in combination with an ObjectDataSource. What I am after is a method to call (eg, after the row has been edited), which will return the values bound to the DataObject (i.e. the object that was passed in, or the object that is defined by the ObjectDataSource.DataObjectTypeName property). Currently, such a method is available when hooking into the RowDataBound action. The property GridViewRowEventArgs.Row.DataItem returns the values that have been bound as a DataObject. I would like to be able to call such a method when I am responing to postbacks (ie, from a button). I have looked at GridView.Rows[_index_].DataItem, but that always seems to be null. Any hint in right direction is appreciated. Cheers

        I Offline
        I Offline
        illusky
        wrote on last edited by
        #3

        boy.pockets wrote:

        I have looked at GridView.Rows[index].DataItem, but that always seems to be null.

        The DataItem in GridViewRows is not saved by viewstate except in some functions such as RowDataBound.

        Permanently stay where my heart locates

        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