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 update

gridview update

Scheduled Pinned Locked Moved ASP.NET
helpannouncement
9 Posts 4 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.
  • 4 Offline
    4 Offline
    4anusha4
    wrote on last edited by
    #1

    I used the following code for updating a record in gridview protected void gvcmem_RowUpdating(object sender, GridViewUpdateEventArgs e) { string sMemberID=gvcmem.DataKeys[e.RowIndex].Values["nMemberID"].ToString(); TextBox txtnumber=(TextBox)gvcmem.Rows[e.RowIndex].FindControl("txtnumber"); string sMemebername = gvcmem.DataKeys[e.RowIndex].Values["sMemberName"].ToString(); DataView dvUpdate = objGeneral.EditMemberPhoneNumber(sMemberID, sMemebername, string.Empty, txtnumber.Text, string.Empty, "1"); if (dvUpdate[0]["sStatus"].ToString() == "Success") { lblmess.Text = "Member Details Updated Sucessfully"; lblmess.Visible = true; } else { lblmess.Text = dvUpdate[0]["sStatus"].ToString(); lblmess.Visible = true; } gvcmem.EditIndex = -1; this.loadGrid(); } while updating when the text in the textbox is changed its not taking the updated text its taking the previous data itself nyone help pls

    C R 2 Replies Last reply
    0
    • 4 4anusha4

      I used the following code for updating a record in gridview protected void gvcmem_RowUpdating(object sender, GridViewUpdateEventArgs e) { string sMemberID=gvcmem.DataKeys[e.RowIndex].Values["nMemberID"].ToString(); TextBox txtnumber=(TextBox)gvcmem.Rows[e.RowIndex].FindControl("txtnumber"); string sMemebername = gvcmem.DataKeys[e.RowIndex].Values["sMemberName"].ToString(); DataView dvUpdate = objGeneral.EditMemberPhoneNumber(sMemberID, sMemebername, string.Empty, txtnumber.Text, string.Empty, "1"); if (dvUpdate[0]["sStatus"].ToString() == "Success") { lblmess.Text = "Member Details Updated Sucessfully"; lblmess.Visible = true; } else { lblmess.Text = dvUpdate[0]["sStatus"].ToString(); lblmess.Visible = true; } gvcmem.EditIndex = -1; this.loadGrid(); } while updating when the text in the textbox is changed its not taking the updated text its taking the previous data itself nyone help pls

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      What happens when you step through in the debugger ?

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      4 1 Reply Last reply
      0
      • C Christian Graus

        What happens when you step through in the debugger ?

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        4 Offline
        4 Offline
        4anusha4
        wrote on last edited by
        #3

        the old text is coming in to the textbox but not the updated one

        N C 2 Replies Last reply
        0
        • 4 4anusha4

          the old text is coming in to the textbox but not the updated one

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          4anusha4 wrote:

          the old text is coming in to the textbox but not the updated one

          You may be binding the grid on page_load without checking IsPostBack.

          Navaneeth How to use google | Ask smart questions

          4 1 Reply Last reply
          0
          • N N a v a n e e t h

            4anusha4 wrote:

            the old text is coming in to the textbox but not the updated one

            You may be binding the grid on page_load without checking IsPostBack.

            Navaneeth How to use google | Ask smart questions

            4 Offline
            4 Offline
            4anusha4
            wrote on last edited by
            #5

            i am not binding it in page_load

            1 Reply Last reply
            0
            • 4 4anusha4

              the old text is coming in to the textbox but not the updated one

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              OK. Let me try again. What happens when you step through the debugger ?

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              4 1 Reply Last reply
              0
              • C Christian Graus

                OK. Let me try again. What happens when you step through the debugger ?

                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                4 Offline
                4 Offline
                4anusha4
                wrote on last edited by
                #7

                there is no error but the record is not updating

                C 1 Reply Last reply
                0
                • 4 4anusha4

                  there is no error but the record is not updating

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  OK, so your datalayer call is being called with the values you expect, but they are not being updated in the database ? Then you need to look at your data layer code to work out why.

                  Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                  1 Reply Last reply
                  0
                  • 4 4anusha4

                    I used the following code for updating a record in gridview protected void gvcmem_RowUpdating(object sender, GridViewUpdateEventArgs e) { string sMemberID=gvcmem.DataKeys[e.RowIndex].Values["nMemberID"].ToString(); TextBox txtnumber=(TextBox)gvcmem.Rows[e.RowIndex].FindControl("txtnumber"); string sMemebername = gvcmem.DataKeys[e.RowIndex].Values["sMemberName"].ToString(); DataView dvUpdate = objGeneral.EditMemberPhoneNumber(sMemberID, sMemebername, string.Empty, txtnumber.Text, string.Empty, "1"); if (dvUpdate[0]["sStatus"].ToString() == "Success") { lblmess.Text = "Member Details Updated Sucessfully"; lblmess.Visible = true; } else { lblmess.Text = dvUpdate[0]["sStatus"].ToString(); lblmess.Visible = true; } gvcmem.EditIndex = -1; this.loadGrid(); } while updating when the text in the textbox is changed its not taking the updated text its taking the previous data itself nyone help pls

                    R Offline
                    R Offline
                    Robert_Pan
                    wrote on last edited by
                    #9

                    web site:http://blog.csdn.net/21aspnet/archive/2007/03/25/1540301.aspx[^]

                    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