This is a migrated thread and some comments may be shown as answers.

DataKeyValues returning null

2 Answers 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joe Kalinowski
Top achievements
Rank 1
Joe Kalinowski asked on 27 Apr 2010, 10:36 PM
I have a grid that uses a custom user control for editing. In the RadGrid1_UpdateCommand event code, the data key values (gridEditableItem.OwnerTableView.DataKeyValues[gridEditableItem.ItemIndex]["LeadDistributionId"]) are returning null. Any idea what would cause this behavior? Note that "gridEditableItem["LeadDistributionId"].Text" returns the correct value.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Apr 2010, 05:35 AM

Hi JOe Kalinowski,

Have you set the DataKeyNames as "LeadDistributionId" for the corresponding GridTableView?

              <MasterTableView  DataKeyNames="LeadDistributionId" DataSourceID="SqlDataSource1">

-Shinu.

0
Joe Kalinowski
Top achievements
Rank 1
answered on 28 Apr 2010, 02:18 PM
Yes I did. However, I didn't specify the data source id. I am using the onneeddatasource event to bind the data source (this.RadGrid1.DataSource = this.sdsLeadDistributionSummary;). However, when I modify the code to specify the data source id in the master table view and radgrid definitions (instead of binding to the onneeddatasource event), the data key values are populated. Why is this? Shouldn't the data key values be populated when using the onneeddatasource event to bind the data source?
Tags
Grid
Asked by
Joe Kalinowski
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Joe Kalinowski
Top achievements
Rank 1
Share this question
or