views:

29

answers:

1

hi, in asp.net 3.5[vs2008] Gridview i got one issue. i have binded objectdatasource with datagridview, provided Get and Update method in ojectdatasource . and in gridview i made some Bound fields visible ="false"[e.g. Primary Ke,Id, foregin Key fields which i need at time of update]. but when i did debugging, i am not getting values for fields which i made visible="false" in updatemethod.

i used 3-tier architecture and passing Businessobject from DAL to BAL to UI and UI to BAL to DAL.

so please can anyone suggest me that if i want some fields which are for coding puporse and should not be displayed to users. what is the method to do it in GridView?

A: 

Add your primary key and foriegn key column names to the GridViews's DataKey property.

solairaja
@solairaj how many datakeys can we have for a gridview
Pandiya Chendur
@least 1 datakey should we need to specify.
solairaja
@solairaja can we have multiple datakeys for a gridview
Pandiya Chendur
http://stackoverflow.com/questions/326233/multiple-datakeynames-in-a-gridview
solairaja
and also Gridview has one propery called DataKeys (its a collection)
solairaja
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.datakeynames.aspx
solairaja
@ solairaja until now i thought that one can't use multiple datakeys in a gridview... You gave the way ...
Pandiya Chendur