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

DataKey Values from SalesDashBoard Demo

1 Answer 7 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Gerry
Top achievements
Rank 1
Gerry asked on 25 Sep 2014, 01:34 PM
Hi
Having a lot of trouble with this one

Setting a Datakey not found error on OrderID property , all I have done is swap out the data source on the ProductsGrid_NeedDataSource method
as below
grid.DataSource = this.GService.GetJobs(GEmployee.id);

Gservice returns two entities as below

var returnedJobs = new List<DemoJobBreakdown>()
{
new DemoJobBreakdown()
{
OrderID = 1,
Job_Subset_ID = 4,
Status = "Complete",
Job_Step = "Installation"
},
new DemoJobBreakdown()
{
OrderID = 2,
Job_Subset_ID = 3,
Status = "Complete",
Job_Step = "Health and Saftey"
}};

and the control is pretty much untouched

‚Äč<telerik:RadGrid AllowFilteringByColumn="true" AllowSorting="true" ShowGroupPanel="true"
BackColor="#393939" ID="ProductsGrid" runat="server" AllowPaging="true" PageSize="15"
Width="980px" CssClass="productsGrid" OnPreRender="ProductsGrid_PreRender" OnNeedDataSource="ProductsGrid_NeedDataSource"
Style="outline: 0">
<MasterTableView AutoGenerateColumns="false" PagerStyle-Mode="NextPrevAndNumeric"
ClientDataKeyNames="OrderID" TableLayout="Fixed">
<Columns>
<telerik:GridBoundColumn DataField="OrderID" HeaderText="Order ID" AutoPostBackOnFilter="true"
ShowFilterIcon="false" HeaderStyle-Width="60px" FilterControlWidth="35px">
</telerik:GridBoundColumn>

</Columns>
</MasterTableView>
<ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true">
<Selecting AllowRowSelect="true" />
<ClientEvents OnRowSelected="RowSelected" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="360px" />
</ClientSettings>
</telerik:RadGrid>


Yet it still blows up every time!
Can anyone help?

Thanks
Gerry

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 30 Sep 2014, 11:17 AM
Hello Gerry,

I would suggest you to try binding the RadGrid initially to the empty array of objects:
void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    RadGrid1.DataSource = new object[] { };
}
  and then, when needed, conditionally pass the data from the service.

Please give it try and let me know if it helps you.

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Gerry
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or