Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Displaying the id/PK in a gridview?

Reply
Thread Tools

Displaying the id/PK in a gridview?

 
 
eagle
Guest
Posts: n/a
 
      07-18-2007
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.


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      07-19-2007
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search Bar not displaying search Engines Zimran Douglas Firefox 1 01-07-2005 02:30 PM
why am i displaying off when I'm actually connected? lcvd1@yahoo.com Wireless Networking 3 12-06-2004 05:34 AM
XP SP2 Keeps Displaying Wireless Conndection Unavailable Emyr Wireless Networking 1 10-28-2004 12:10 AM
Thunderbird displaying messages in italics Martin J Hooper Firefox 1 09-30-2004 02:14 PM
Re: Displaying images Hellmark Firefox 0 06-27-2003 08:06 AM



Advertisments