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" >
</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;
The signature was created exactly how I defined it manually, using UltraGridEventArgs. I even tried setting the break point on the event that was created for me, and it didn't work.
Hello,
Have you tried including it from design view? If not, then please follow the steps below and let me know if you get any issues.
1) Open the properties window for the UltraWebGrid
2) Click on the Events button and find the InitializeDataSource event in the list.
3) Now double click on the event and see how it created the signature of the method in the code behind page.
Thanks
Sarita
For some reason, the InitializeDataSource event is not firing. I have declared the event in asp code "OnInitializeDataSource" in the grid control. I have tried using the EventArgs and UltraWebEventArgs and it's not working for me. I'm using the assembly
Infragistics35.WebUI.UltraWebGrid.v9.1, Version=9.1.20091.1015
I read somewhere there were versions that made the InitializeDataSource invisible. Is this the case here?
It seems you are setting the DataSource in the Page_Load event. I was wondering how you are handling the postback. I'm not sure if you are handling the InitializeDataSource event on the grid. If not, then please do so and call the method GetHierarchicalData from this event. Please visit the following link to how to use WebHierarchicalDataSource in code.
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2009.1/CLR3.5/html/WebHierarchicalDataSource_Using_WebHierarchicalDataSource_in_Code.html