473,406 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 1387

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rufus | last post by:
Hi, I was wondering how a DataGrid can handle a DataSet with a composite key. How would I update 1 row in a database having a composite key? A possible solution would be to concatenate my...
2
by: David Stephen | last post by:
I'd like to use a datagrid to display a result from a datatable but based on the data I'd like to display rows with merged cells is a new type of heading across a couple of standard cells or a...
1
by: Bill Yin | last post by:
the first column title is "abc" the second column title is 'efg'
2
by: Lane | last post by:
I'm completly LOST !!! I need to create a datagid with data from a database which i can do, but i need a additional row appended to the grid as a textbox for information to be gathered and stored. ...
1
by: Joe Bloggs | last post by:
I am trying display the contents of a table in a web page, select certain rows from that table and then display the fields that I have selected (now table columns) as text in a Label object....
2
by: DC Gringo | last post by:
I have a datagrid control that has paging set up and working. What I would like is a total record count (not just per page) in the header or near the header of the datagrid. Here's my code: ...
5
by: Jason | last post by:
I've been trying to figure out a good way to do this but haven't had much luck, any input would be greatly appreciated. Basically, after a datagrid is sorted, how can I get the primary key value...
7
by: Dave | last post by:
Hi, Maybe I'm missing something with the DataKeyField attribute of a datagrid but it seems that it's somewhat limiting since this only allows you to specify one field as the key. I have a...
3
by: Pat | last post by:
I have a 2 nested Datagrid. When i select a row in the Master Datagrid i populate the Child databrid using myDataGrid.SelectedIndex value as the filter and setting the DataKeyField. I enabled...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.