Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
UltraWebGrid and WebHierarchicalDataSource problem using dynamically created object
posted

I have an UltraWebGrid which uses the WebHierarchicalDataSource to create a parent/child relationship for 2 List<> objects.   I originally was using 2 ObjectDataSources to capture what I needed and bind to the dataviews from the WebHierarchicalDataSource.  This worked fine.  However, I want to filter the objects based on certain criteria(I don't want to use the filtering mechanism in the UltraWebGrid).   So I took the ObjectDataSource controls out and decided to bind the views dynamically to the List<> objects after I filtered the lists accordingly(based on my own search mechanism).  The original grid posts fine, but when I do a postback, I get the error:

"DataView has no DataSourceID or DataSource set."

It seems that the dataview is trying to bind again after the Page_Init event.  Since I repopulate the dataviews in the click event handler, the binding is happening too soon and erroring out.  Can I get some help with this?  Thanks.

 

Here is the asp code, I commented out the ObjectDataSource cause I'm not using it anymore:

<Infragistics:WebHierarchicalDataSource ID="InvoiceSummaryHierarchicalDS" runat="server" >

 

<DataViews>

 

 

<Infragistics:DataView ID="parentView" />

 

 

<Infragistics:DataView ID="childView" />

 

 

</DataViews>

 

 

<DataRelations>

 

 

<Infragistics:DataRelation ParentColumns="GroupId" ChildColumns="GroupId" ParentDataViewID="parentView" ChildDataViewID="childView" />

 

 

</DataRelations>

 

 

</Infragistics:WebHierarchicalDataSource >

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<!-- <asp:ObjectDataSource ID="objOpenInvoiceSummaryGroups" SelectMethod="GetParentInvoiceSummaries" TypeName="Module.Invoices.InvoiceSummariesPresenter" runat="server" >

 

 

<SelectParameters>

 

 

<asp:Parameter Type="Int32" Name="status" DefaultValue="1" Direction="InputOutput" />

 

 

</SelectParameters>

 

 

</asp:ObjectDataSource>

 

 

<asp:ObjectDataSource ID="objOpenInvoiceSummaryLocations" SelectMethod="GetChildInvoiceSummaries" TypeName="Module.Invoices.InvoiceSummariesPresenter" runat="server" >

 

 

<SelectParameters>

 

 

<asp:Parameter Type="Int32" Name="status" DefaultValue="1" Direction="InputOutput" />

 

 

</SelectParameters>

 

 

</asp:ObjectDataSource>-->

protected void Page_Load(object sender, EventArgs e)

{

 

List

 

<Svc.InvoiceBillSummary> parentList = _presenter.GetParentInvoiceSummaries((int)Svc.InvoiceStatusTypeEnum.Closed);

 

 

List<Svc.InvoiceBillSummary> childList = _presenter.GetChildInvoiceSummaries((int)Svc.InvoiceStatusTypeEnum.Closed);

//filtering happens here

GetHierarchicalData(parentList, childList);

}


private void GetHierarchicalData(List<Svc.InvoiceBillSummary> parentList, List<Svc.InvoiceBillSummary> childList)

 

{

parentView.DataSource = parentList;

childView.DataSource = childList;

}