Thanks.
Ron
4 Answers, 1 is accepted
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
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!
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=...";
}