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

Telerik Radgrid datasource with stored procedure

1 Answer 689 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ana
Top achievements
Rank 1
Ana asked on 21 Jun 2014, 01:25 AM
Hi,

I have a Hierarchical Grid. The master one has a data source tied with a stored procedure.

I have created the nested/hierarchical data with another data source tied with a stored procedure.

Both stored procedures have a common fields which I did a relation.   The master view data is displaying correctly.  No issues here. But, when I clicked on expand of master grid, I don't get the child items. No child records to display is the message I see.  But, it has data in database and see when I individually run the stored procedures.

I followed this video but wasn't successful.  http://tv.telerik.com/watch/radcontrols-for-aspnet-ajax/radgrid-using-the-designer-to-create-a-hierarchical-grid

I am not sure what I did wrong.  Can anyone please give me an example to bind data sources using stored procedures?


Thank you.

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 25 Jun 2014, 11:26 AM
Hello Ana,

I am sending you a simple example based on our hierarchy demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/declarative-relations/defaultcs.aspx
The example uses two stored procedures:

USE [NORTHWIND.MDF]
GO
/****** Object:  StoredProcedure [dbo].[GetCustomers]    Script Date: 6/25/2014 1:56:12 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetCustomers]
AS
   SELECT * FROM Customers
And
USE [NORTHWIND.MDF]
GO
/****** Object:  StoredProcedure [dbo].[GetOrders]    Script Date: 6/25/2014 1:59:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetOrders]
    @CustomerID nvarchar(50)
AS
    SET NOCOUNT ON;
    SELECT * FROM Orders Where CustomerID = @CustomerID

The SqlDataSources are configured to use these stored procedures:
<asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="GetCustomers" SelectCommandType="StoredProcedure"
        runat="server"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="GetOrders" SelectCommandType="StoredProcedure"
        runat="server">
        <SelectParameters>
            <asp:SessionParameter Name="CustomerID" SessionField="CustomerID" Type="string"></asp:SessionParameter>
        </SelectParameters>
    </asp:SqlDataSource>
   
Please check the example and let me know what differs in your case.

Regards,
Radoslav
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
Ana
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or