Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > How to avoid hardcoding DataKeyField name ?

Thread Tools

How to avoid hardcoding DataKeyField name ?

Jeff Robichaud
Posts: n/a

How can I avoid hardcoding the name of the DataKeyField property of a
DataGrid ?


datagrid.DataSource = someSource;
datagrid.DataKeyField = "employeeId";

The above works but it's not what I want, because whenever the name of the
field changes, I'm screwed. Avoiding this is the purpose of strongly-typed
datasets (or using collections or whatever data layer abstraction mechanism
you like) as I understand it, but I'd like to know what you n-tier gurus do
in this case ?

- Jeff

Reply With Quote

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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
bypassing web form hardcoding login and password cgian31 Java 11 10-21-2005 03:19 PM
bypassing webforms hardcoding login and password cgian31 HTML 1 10-21-2005 03:54 AM
datagrid hardcoding... Alen Smith ASP .Net 6 06-30-2005 06:44 PM
Alternatives to hardcoding a password into the source code Gyruss Java 6 06-20-2005 01:16 AM