|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Gridview not updating database rowI'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. Can you show some code?
-- Show quoteHide quoteChristopher 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. 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. > > 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 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
These controls are a real mess
Menu Control building via code .NET multi-column listbox for webpages? TreeView Security error Catching event in Menu control when bound with sitemap Script edit server control multiview menu webcontrol Viewstate and Master page with programmatically created content Other browsers |
|||||||||||||||||||||||