Groups | Blog | Home
all groups > asp.net datagrid control > january 2007 >

asp.net datagrid control : Field not updating in gridview unless visible?


et
1/22/2007 8:30:15 AM
In my gridview are the primary keys of the record that is being modified,
and obviously I have them hidden. However, when I try to use the update,
the id parameter -- or any field that is not visible -- does not come across
and the update fails since it's based on that id. Not sure that quite makes
sense to me, if I didn't want to update the field, I would make it read
only, visibility should have nothing to do with it. What is the workaround
to this?

Eliyahu Goldin
1/22/2007 5:38:49 PM
Any control with Visible=false doesn't get rendered to the client and,
naturally, doesn't come back on postbacks. You can leave Visible=true and
hide with css rule display:none.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


[quoted text, click to view]

et
1/23/2007 5:24:52 AM
Thanks for the suggestion, however, a bound column is still displayed,
although the value is invisible when in edit mode, and a template column
still displays a blank column. I can live with a blank column, but wonder
if there are any other ideas?


"Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldDinN@mMvVpPsS.org> wrote in
message news:u$oUSvjPHHA.1380@TK2MSFTNGP05.phx.gbl...
[quoted text, click to view]

shekher
2/8/2007 9:21:31 PM
use this property for your gridview
DataKeyNames="Field Name"

Then in the update parameters you can use control parameters
---
AddThis Social Bookmark Button