|
|
|
start date: Wed, 18 Jul 2007 07:15:38 -0600,
posted on: microsoft.public.dotnet.framework.aspnet.datagridcontrol
back
| Thread Index |
|
1
eagle
|
|
2
Eliyahu Goldin
|
Displaying the id/PK in a gridview?
So how does everyone hide the primary key in a gridview with a datasource to
a table, let's say. If you don't display it, then you can't update the
records. Users don't want to see this field, particularly if it's a guid.
Example:
Select ID, ProductName from tblProducts is the datasource
The gridview has 2 bound fields, the id and the productname. If you set the
id to invisible, it's not rendered and it is lost when you attempt to update
that record.
Date:Wed, 18 Jul 2007 07:15:38 -0600
Author:
|
Re: Displaying the id/PK in a gridview?
Add "ID" to the DataKeyNames property and take out of the query.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"eagle" wrote in message
news:%23tJC82TyHHA.4640@TK2MSFTNGP03.phx.gbl...
> So how does everyone hide the primary key in a gridview with a datasource
> to a table, let's say. If you don't display it, then you can't update the
> records. Users don't want to see this field, particularly if it's a guid.
> Example:
>
> Select ID, ProductName from tblProducts is the datasource
>
> The gridview has 2 bound fields, the id and the productname. If you set
> the id to invisible, it's not rendered and it is lost when you attempt to
> update that record.
>
>
Date:Thu, 19 Jul 2007 12:02:28 +0300
Author:
|
|
|