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

ObjectDataSource Parameters are null in Designer mode - have values in Preview

1 Answer 194 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 09 Nov 2012, 10:30 AM
Hello,

I am trying to use the ObjectDataSource with some parameters being passed to the DataMember method (it returns a data table and accepts 2 string parameters). Have configured the values to be passed in the 'Configure Data Source Parameters' screen of the DataSource wizard.

When using it in Designer, it will pass null parameters (break in debugger to examine the values passed proves this) BUT when doing a Preview the values specified in the wizard are being passed on. This causes a bit of an issue, as unless I set default values for my parameters (which kind of defeats the purpose) I am not able to access the Fields returned and design my report.

Is there something I'm missing here?

I have attached a couple of screenshots, please let me know if any more info is required.

Also, on a side note: When previewing the report, when parameters are being passed on, I noticed that my 'GetData()' method is called multiple times. How does that work? One would expect the report to call the method once and get the data table, then use it for the report... is this the behaviour when running in release mode as well?

Thanks in advance,

George

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 13 Nov 2012, 12:03 PM
Hi George,

The ObjectDataSource parameters are not evaluated in design time. Thus the default value type is used. We do have some ideas in mind about introducing design time parameters for the ObjectDataSource component. However this is planned for a subsequent internal build or official release. In the meantime our suggestion is to fallback to design time values in your DAL and insure that your DAL will not fail if unexpected parameter values are provided. Another option is to use the SqlDataSource component that works with design time parameters.

About invoking the data member multiple times. Do you reference the ObjectDataSouce in multiple data items (report parameters, report, table, chart, list, crosstab)? If this is the case have in mind that the data source components are declarative and they only specify how to obtain the data for the data item. They don't store or cache the data. Thus they are invoked once for every data item that is referencing the data source components. In this line of thoughts if your data member execution is time and resource expensive our suggestion is implement in your DAL a data source caching mechanism.

All the best,
Peter
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

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