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

Data explorer no data sources shown

4 Answers 323 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 27 Jan 2011, 10:46 PM
I have assigned a business object to a report's datasource, select a data source member (a method returning the object), and configure the data source parameter,  but when I go into the data explorer I don't see it. What do I need to do to make this happen?
Thanks.
Ron

4 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 01 Feb 2011, 04:20 PM
Hi Ron,

Can you clarify whether you use our ObjectDataSource Component? The ObjectDataSource component is providing a way for you to bind the Data Report Items to a middle-tier business object without extensive code. Generally if your data layer is returning data, setting the data item's (report) datasource property should be enough. However If you have used the ObjectDataSource component to set a data item's datasource property and still the Data Explorer doesn't populate with the data's schema we will appreciate if you open a support thread and send us a runnable sample project that exhibits the issue to debug locally.

Greetings,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Lane
Top achievements
Rank 1
answered on 13 Jan 2012, 02:14 AM
I am experiencing the same problem using ObjectDataSource and LINQ to SQL classes.  Can you point me to any previously identified solution to this problem?  Thanks.
0
Peter
Telerik team
answered on 13 Jan 2012, 09:15 AM
Hi Lane,

Check out the LINQ in an object data source forum thread that elaborates on how to utilize LINQ to SQL with an ObjectDataSource component.

Regards,
Peter
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Lane
Top achievements
Rank 1
answered on 13 Jan 2012, 06:50 PM
Thanks! 

The first thing I tried was to override the default constructor for the data context, passing in the hard-coded connection string, but it still didn't work.

What finally worked was to create a business object class like the one in the sample app, and instantiating the data context in each method, passing in the connection string.

I took this one step further because I want to determine at runtime whether the consuming ASP.NET app is in test or in production in order to pass the appropriate connection string.  So I added a reference to System.Web and wrote this method.

private string GetConnectionString()
{
    try
    {
        string url = HttpContext.Current.Request.Url.AbsoluteUri;
        string conn;
        if (url.Contains("localhost") || url.Contains("mydevserver"))
        {
            conn = "DevConnectionString";
        }
        else
        {
            conn = "ProdConnectionString";
        }
 
        // Retrieve the connection string settings from the configuration file.
        var connectionSettings = ConfigurationManager.ConnectionStrings[conn];
 
        // If a valid connection string setting exist, then we are at run-time,
        // so we should use this connection string to connect to the database.
        if (connectionSettings != null)
        {
            return connectionSettings.ConnectionString;
        }
    }
    catch { }
    // If no valid connection string setting exist, then we are at design-time,
    // so return a default connection string for preview and testing purposes.
    return "Data Source=DevDatabase1;Initial Catalog=...";
}

Tags
General Discussions
Asked by
Ron
Top achievements
Rank 1
Answers by
Peter
Telerik team
Lane
Top achievements
Rank 1
Share this question
or