This question is locked. New answers and comments are not allowed.
The issue I am having is when binding an OpenAccessDataSource control to a RadComboBox, I am receiving this error: "The 'IObjectScope' is already closed." This error message only occurs when I try to set a WhereParameter's DefaultValue in the OpenAccessDataSource.Selecting event. In my database, I have a Company table. I also have a ProductCategory table, which is a detail to the Company table. Finally, I have a Product table that is a detail to the ProductCategory table. My schema is as follows:
Company
int Id
string CompanyName
ProductCategory
int Id
int CompanyId
string CategoryName
Product
int Id
int CategoryId
string ProductName
At the top of my Page, I have two RadComboBox controls. They are used for filtering data in a grid that sits below the two RadComboBox controls. One RadComboBox contains a list of Company objects, and the other contains a list of ProductCategory objects.
The ProductCategory RadComboBox is tied to an OpenAccessDataSource who's Where property is "CompanyId == @CompanyId." The CompanyId parameter has a default value of 0, and its source is set to "None." In the OpenAccessDataSource.Selecting event, I use the following code:
Setting the DefaultValue of the parameter results in the OpenAccessDataSource firing a second time. This is resulting in the RadComboBox being DataBound twice. My log looks like this:
"Entering method: ComboCategoryDataSource_Selecting"
"Entering method: ComboCategoryDataSource_Selecting"
"Leaving method: ComboCategoryDataSource_Selecting"
"Entering method: ComboCategoryComboBox_DataBound"
"Leaving method: ComboCategoryComboBox_DataBound"
"Leaving method: ComboCategoryDataSource_Selecting"
"Entering method: ComboCategoryComboBox_DataBound"
"Leaving method: ComboCategoryComboBox_DataBound"
Company
int Id
string CompanyName
ProductCategory
int Id
int CompanyId
string CategoryName
Product
int Id
int CategoryId
string ProductName
At the top of my Page, I have two RadComboBox controls. They are used for filtering data in a grid that sits below the two RadComboBox controls. One RadComboBox contains a list of Company objects, and the other contains a list of ProductCategory objects.
The ProductCategory RadComboBox is tied to an OpenAccessDataSource who's Where property is "CompanyId == @CompanyId." The CompanyId parameter has a default value of 0, and its source is set to "None." In the OpenAccessDataSource.Selecting event, I use the following code:
protected void ComboCategoryDataSource_Selecting(object sender, Telerik.OpenAccess.OpenAccessDataSourceSelectingEventArgs e) |
{ |
SiAuto.Main.EnterMethod("ComboCategoryDataSource_Selecting"); |
ComboCategoryDataSource.WhereParameters["CompanyId"].DefaultValue = UserSession.CompanyId.ToString(); |
SiAuto.Main.LeaveMethod("ComboCategoryDataSource_Selecting"); |
} |
Setting the DefaultValue of the parameter results in the OpenAccessDataSource firing a second time. This is resulting in the RadComboBox being DataBound twice. My log looks like this:
"Entering method: ComboCategoryDataSource_Selecting"
"Entering method: ComboCategoryDataSource_Selecting"
"Leaving method: ComboCategoryDataSource_Selecting"
"Entering method: ComboCategoryComboBox_DataBound"
"Leaving method: ComboCategoryComboBox_DataBound"
"Leaving method: ComboCategoryDataSource_Selecting"
"Entering method: ComboCategoryComboBox_DataBound"
"Leaving method: ComboCategoryComboBox_DataBound"