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. gridview problem

gridview problem

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netannouncement
4 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.
  • S Offline
    S Offline
    sohne
    wrote on last edited by
    #1

    Hi, I m working with asp.net 2.0. I set the GridView.DataKeys as ID. When I click on Update button. the updating event is raised. But in the e.Keys/NewValues/OldValues there is always 0. But I get the rowindex of hte row i edited. I think i didn't set any property of gridview. thats why i don't get value in e.NewValues Property Please help

    M 1 Reply Last reply
    0
    • S sohne

      Hi, I m working with asp.net 2.0. I set the GridView.DataKeys as ID. When I click on Update button. the updating event is raised. But in the e.Keys/NewValues/OldValues there is always 0. But I get the rowindex of hte row i edited. I think i didn't set any property of gridview. thats why i don't get value in e.NewValues Property Please help

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Since I don't see your sample code, so IMO you may want to check a couple of properties: + The DataKeyNames property of the GridView control. + Do you use the BoundField or TemplateField with the data binding expression in the GridView control? If you use the expression, make sure it support two-way data binding. + Do you any datasource control with the GridControl? If yes, check the ConflictDetection property. You can see more details in MSDN[^]

      S 1 Reply Last reply
      0
      • M minhpc_bk

        Since I don't see your sample code, so IMO you may want to check a couple of properties: + The DataKeyNames property of the GridView control. + Do you use the BoundField or TemplateField with the data binding expression in the GridView control? If you use the expression, make sure it support two-way data binding. + Do you any datasource control with the GridControl? If yes, check the ConflictDetection property. You can see more details in MSDN[^]

        S Offline
        S Offline
        sohne
        wrote on last edited by
        #3

        My problem was i didn't attached an objectdatasource to the gridview. I was only getting RowIndex in the RowUpdating event. As i was not able to get the newValues,oldValues/Keys, I attached an objectdatasource(which is attached .dll file) to the gridview control. Now when i click on update link on the gridview, I get the newValues,oldValues/Keys. If i want to get access to newValues,oldValues/Keys in a RowUpdating event of a gridview/detailsview, do i have to always assign an objectdatasource.

        M 1 Reply Last reply
        0
        • S sohne

          My problem was i didn't attached an objectdatasource to the gridview. I was only getting RowIndex in the RowUpdating event. As i was not able to get the newValues,oldValues/Keys, I attached an objectdatasource(which is attached .dll file) to the gridview control. Now when i click on update link on the gridview, I get the newValues,oldValues/Keys. If i want to get access to newValues,oldValues/Keys in a RowUpdating event of a gridview/detailsview, do i have to always assign an objectdatasource.

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          sohne wrote:

          If i want to get access to newValues,oldValues/Keys in a RowUpdating event of a gridview/detailsview, do i have to always assign an objectdatasource.

          Yes, you do. If you don't specify the datasource in the DataSourceID property of the control, you only have the row index value in the event data argument GridViewUpdateEventArgs.

          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