Home All Groups Group Topic Archive Search About

Gridview not updating database row

Author
26 Jan 2006 12:29 AM
Eric
I've meticulously set up gridview controls both with the wizard and
programmatically, using a sqldatasource and can not get the update command
to pass the new column value to the database, it always passes the original
value, thus no update occurs.  I've run traces with SQL profiler, and the
original value is always sent to the database.  I can get updates to work
with detailsview controls by doing the exact same configuration.  Why won't
the gridview update work, and what would the difference be?  Thanks.

Author
26 Jan 2006 4:00 PM
Christopher Reed
Can you show some code?
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

Show quoteHide quote
"Eric" <elm***@hotmail.com> wrote in message
news:u3Cff%23gIGHA.3752@TK2MSFTNGP11.phx.gbl...
> I've meticulously set up gridview controls both with the wizard and
> programmatically, using a sqldatasource and can not get the update command
> to pass the new column value to the database, it always passes the
> original value, thus no update occurs.  I've run traces with SQL profiler,
> and the original value is always sent to the database.  I can get updates
> to work with detailsview controls by doing the exact same configuration.
> Why won't the gridview update work, and what would the difference be?
> Thanks.
Author
26 Jan 2006 6:38 PM
Eric
Thanks.  I figured it out.  I forgot to check for a postback before
databinding the grid view in the page load event sub.  This must have
reloaded the original data into the grid before sending the update command
to the database.


Show quoteHide quote
"Christopher Reed" <carttu@nospam.nospam> wrote in message
news:eI0wlGpIGHA.3056@TK2MSFTNGP09.phx.gbl...
> Can you show some code?
> --
> Christopher A. Reed
> "The oxen are slow, but the earth is patient."
>
> "Eric" <elm***@hotmail.com> wrote in message
> news:u3Cff%23gIGHA.3752@TK2MSFTNGP11.phx.gbl...
>> I've meticulously set up gridview controls both with the wizard and
>> programmatically, using a sqldatasource and can not get the update
>> command to pass the new column value to the database, it always passes
>> the original value, thus no update occurs.  I've run traces with SQL
>> profiler, and the original value is always sent to the database.  I can
>> get updates to work with detailsview controls by doing the exact same
>> configuration. Why won't the gridview update work, and what would the
>> difference be? Thanks.
>
>
Author
1 Feb 2006 1:43 AM
flyfisherguy
I'm also experiencing this problem, but it seems to be  happening with the even-numbered rows only! That is, the first, third, fifth, etc. rows update just fine but the second, fourth, sixth, etc. rows are not. Really strange. Anybody else seen this happening in their gridview objects?
---
Posted via www.DotNetSlackers.com
Author
8 Feb 2006 5:09 PM
Rkj2006
Hello All,

I am also facing a similar problem. I have a GridView with SqlDataSource. I
have configured the UpdateCommand using an UPDATE SQL. The update works fine
if there is no Master Page or other User Controls. Whenever I include the Web
User Control (eg. header or footer) or Master Page, the new values edited on
the Grid are lost. Therefore the Update Command is updating the old values. I
have also added the EnableViewState=true on the Page as well as MasterPage.
But same problem.

Appreciate if someone could shed some light on this update problem.

Thanks

Rkj