Trying to put together a proof-of-concept using the Trial Version of 2009.2. Created a new web page and added an ObjectDataSource, WebHierarchicalDataSource, and WebHierarchicalDataGrid to the page and configured following the examples in the QuickStart video and the WSDG Sample, but not data is shown when the page is run.
The proper column headers appear, and a test of the method that returns the strongly-typed collection verifies that it is retrieving and populating the collection with data, but nothing shows up on the page.
This is an example for a self-referencing data set. Here is the code from the page.
<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" AutoGenerateBands="False" AutoGenerateColumns="False" DataKeyFields="NamespaceID" DataMember="odsNamespaceList_DefaultView" DataSourceID="whds" Height="350px" IsSelfReference="True" Key="odsNamespaceList_DefaultView" Width="400px">
<Columns> <ig:BoundDataField DataFieldName="NamespaceID" Key="NamespaceID"> <Header Text="NamespaceID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="ParentID" Key="ParentID"> <Header Text="ParentID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="ShortName" Key="ShortName"> <Header Text="ShortName" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="DisplayName" Key="DisplayName"> <Header Text="DisplayName" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="FeaturePath" Key="FeaturePath"> <Header Text="FeaturePath" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="InheritsFromParent" Key="InheritsFromParent"> <Header Text="InheritsFromParent" /> </ig:BoundDataField> </Columns>
<Bands> <ig:Band DataMember="odsNamespaceList_DefaultView" ShowFooter="false" ShowHeader="false" IsSelfReference="true" AutoGenerateColumns="false">
</ig:Band> </Bands></ig:WebHierarchicalDataGrid>
<ig:WebHierarchicalDataSource ID="whds" runat="server"> <DataRelations> <ig:DataRelation ChildColumns="ParentID" ChildDataViewID="odsNamespaceList_DefaultView" ParentColumns="NamespaceID" ParentDataViewID="odsNamespaceList_DefaultView" /> </DataRelations> <DataViews> <ig:DataView ID="odsNamespaceList_DefaultView" DataMember="DefaultView" DataSourceID="odsNamespaceList" /> </DataViews> </ig:WebHierarchicalDataSource>
<asp:ObjectDataSource ID="odsNamespaceList" runat="server" SelectMethod="GetNamespaceList" TypeName="Test.BLL.TestDataGenerator"> </asp:ObjectDataSource>
It seems like I must be missing something simple, but darned if I can figure out what it is.
Negative values are not an option as well. Only null and DbNull are allowed.
OK, that works. Are there any other disallowed values? What about negative numbers?
You are using 0 for ParentId value of the root items. This is not supported by WHDS - it can not determine which are the root records and that's why no data is returned.
You can modify the ParentID property type to nullable int and then in the GetNamespaceList method you can assign null instead of zero:
ns.ParentID =
null;
That will fix the issue.
Hello Nikola,
There is no database. This is being tested with a strongly-typed class and a fake data generator method.
To keep this relatively small, I created a new project (Visual Studio 2008) and started the WHDG page from scratch, leaving out the child bands as you recommended, and still I get nothing rendered except the header line.
The page is named TestWHDG_ObjectSource.aspx in the attached zip file. Note that in order to meet the size limitations for attachments in this forum, I stripped out all of the image files.
EDIT: Now that this is solved, removed the attachment.
Hi,
In the case of self-ref data you don't have to define child band(s), you just have to set IsSelfReference="True" on the root band (the grid itself).
If you still can't figure out what's wrong with your sample, please attach the whole project including the data base so we can investigate further.