Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2008, 08:25 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default DataKey / DataKeyField / DataKeyNames

Can someone please help explain the difference between the three..and also help with the following:

I am trying to reference a field that is returned from my objectdatasource without having to put a control on the page. It was suggested that I use DataKeys - but I have always understood DataKeys to represent (I might be getting this confused with DataKeyNames?) the primary key of return. So, I am actually having returned the key, memberID, along with fName, lName, UserID and a few others. I am wanting to get access to "UserID" - which is not my primary key....and thus I am getting extremely confused with DataKey, DataKeyField & DataKeyNames.

I know, in my DataList, that I can set a "DataKeyField"---can I only reference (in the code-behind methods) fields that I put in here...thus, when I do something like DataList1.DataKeys(something)--I can only reference what I put on the control's "DataKeyField" property?---AND, as I mentioned earlier--can I reference stuff outside the primary key (let's say I wanted lname) while still not breaking what is needed to have a primary key in case the row is selected for an update or soemthing else?

Please help.

Sincerely,
Rob






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Access DataKeyField from DataList in C# shakti_2505270 ASP.NET 1.0 and 1.1 Basics 1 October 26th, 2007 01:51 AM
DataKey error in Editable datagrid hoailing22 ASP.NET 1.0 and 1.1 Basics 2 June 10th, 2005 10:51 PM
DataGrids and DataKeyField booksnore2 Classic ASP Basics 2 July 5th, 2004 08:38 AM
Error aout datagrid.datakey(i) Blueman137 ASP.NET 1.0 and 1.1 Basics 0 March 21st, 2004 09:37 PM
How to add 2 columns in DataGrid1.DataKeyField drasko C# 0 December 6th, 2003 09:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.