DataKey Values from SalesDashBoard Demo

2 posts, 0 answers
  1. Gerry
    Gerry avatar
    2 posts
    Member since:
    Sep 2014

    Posted 25 Sep 2014 Link to this post

    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(;

    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">
    <telerik:GridBoundColumn DataField="OrderID" HeaderText="Order ID" AutoPostBackOnFilter="true"
    ShowFilterIcon="false" HeaderStyle-Width="60px" FilterControlWidth="35px">

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

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

  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 30 Sep 2014 Link to this post

    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.

    Maria Ilieva

    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.

  3. Telerik UI for ASP.NET Core is out
Back to Top