Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Is it possible to set the DataKey property of a DataGrid manually?

Reply
Thread Tools

Is it possible to set the DataKey property of a DataGrid manually?

 
 
Alex
Guest
Posts: n/a
 
      04-24-2004
I'm wondering how I can add data to the datakey property of the DataGrid.
It seems to be read only. How can I populate it?
I'm using data bound columns, however do not autogenerate the entire grid
table.


 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      04-25-2004
Hi,

you can set DataKeyField programmatically, but of course if you mean
changing the key value for separate rows (taking it from different column
based on row), then it is not possible. In that case, you'd pick the data
column you need via DataItem property of every DataGridItem (in
ItemDataBound for example).

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Alex" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
I'm wondering how I can add data to the datakey property of the DataGrid.
It seems to be read only. How can I populate it?
I'm using data bound columns, however do not autogenerate the entire grid
table.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?SG1udA==?=
Guest
Posts: n/a
 
      04-25-2004
Hi

Try adding all yo columns in code-behind instead of html ... that is add all columns to yo datagrid programatically
 
Reply With Quote
 
 
 
Reply

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
Find ItemIndex given DataKey in DataGrid Rod ASP .Net 2 03-09-2007 02:25 PM
Datagrid selectedindex from datakey value Joel Reinford ASP .Net 7 10-05-2005 08:24 PM
Re: DataGrid and DataKey Karl ASP .Net 1 08-26-2004 04:37 PM
Datakey in Datagrid J. Ormaetxe ASP .Net 3 10-29-2003 12:54 PM
Datakey for Datagrid Kimberly ASP .Net Datagrid Control 1 07-19-2003 11:06 AM



Advertisments