PC Review


Reply
Thread Tools Rate Thread

DataGrid - DataKeyField!!

 
 
Adam Knight
Guest
Posts: n/a
 
      7th Aug 2005
I have a datagrid like so:

<aspataGrid ID="dgSubAreas" Runat="server"
AutoGenerateColumns="False"
DataKeyField=""
DataSource='<%#
Container.DataItem.Row.GetChildRows("relSubAreas") %>'>

Its data source is the result of a table relation created like this:
ds.Relations.Add("relSubAreas", ds.Tables("Areas").Columns("area_id"),
ds.Tables("SubAreas").Columns("parent_id"))

When i try to set its datakeyfield attribute to a column name 'area_id' i
get an error.
Something to the effect that datarow doesn't contain a property called
area_id.
If is use <%# Container.DataItem("area_id") within the control itself it is
fine.

Can someone enlighten me on how to set the datakeyfield to draw the right
data "area_id".
Cheers,
Adam


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Avoid hardcoding DataKeyField property of DataGrid... Jeff Robichaud Microsoft ADO .NET 2 23rd Aug 2006 03:58 PM
Is it possible to locate a row by its datakeyfield on web datagrid =?Utf-8?B?QSBmcnVzdHJhdGVkIGRldmVsb3Blcg==?= Microsoft Dot NET 0 28th Apr 2005 04:33 PM
Find item on web datagrid by datakeyfield, possible? =?Utf-8?B?QSBmcnVzdHJhdGVkIGRldmVsb3Blcg==?= Microsoft Dot NET 0 28th Apr 2005 04:28 PM
2nd attempt: ASP:Datagrid and Complex DataKeyfield Homer J. Simpson Microsoft ASP .NET 1 9th Mar 2004 01:33 PM
Newbie question: ASP Datagrid + Complex DataKeyField Homer J. Simpson Microsoft ASP .NET 2 5th Mar 2004 06:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:59 AM.