469,596 Members | 2,241 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,596 developers. It's quick & easy.

DataGrid - DataKeyField!!

I have a datagrid like so:

<asp:DataGrid 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
Nov 19 '05 #1
0 1277

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by rufus | last post: by
2 posts views Thread by David Stephen | last post: by
1 post views Thread by Bill Yin | last post: by
2 posts views Thread by Lane | last post: by
1 post views Thread by Joe Bloggs | last post: by
2 posts views Thread by DC Gringo | last post: by
7 posts views Thread by Dave | last post: by
3 posts views Thread by Pat | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.