Marcie, ASP.NET Blogger Girl
Isn't it a good sign if the one and only authority in DataGrid controls is referring to my article ;) Thanks a lot, Marcie!
Seems to be a great control , excellent effort. Works fine with the sample application proveded - where data source is read from an xml file. I m using SQL db(northwind ) and tried it for tabels [Parent as] 'customer' and [Child as] 'order' (relation of field 'customerid') In the child child template file i have a simple asp.net datagrid control and to bind this child contorl i use the code as said, but unfortunately get following error when typecasting the (..dgi..)datagriditem to data set: "Specified cast is not valid." i m pasting the code i m using to bind the datagrid in the child template Dim dgi As DataGridItem = CType(Me.BindingContainer, DataGridItem) Dim ds As DataSet = CType(dgi.DataItem, DataSet) dg.DataSource = ds dg.DataMember = "orders" dg.DataBind() ----------------------
Your DataGridItem should most likely be cast to DataRowView, rather than DataSet DGG
Hello! Excellent control! I'm experiencing the same issue as the person above, but only when using a SQL database. The sample application that uses XML data seems to be fine. This cast error crops up during postback only, not compilation. My research shows that it's an issue with viewstate. See this article from Microsoft: <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327287">http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327287</a>. Its solution is: Make sure that the control tree is re-created on postback in the same order that it was saved at the end of the previous request. In respect to the HierarGrid control, how can this solution be implemented? Thanks for any input! PK
I know it's a bit late, but maybe someone will come looking to the same page.
2 points that can cuase this problem:
1. Not setting the property of the HierarGrid.TemplateDataMode to "Table"
2. Trying to bind too soon - Try Page Events-OnDataBinding - my experience with using Page_Load indicates that it's only on DataBinding that the dataset gets passed over.
If any of the original posters here pick this up, please tell me what you are using now instead of HierarGrid - I'm programming in ASP.NET 2.0 a la VB and I couldn't get the Gridview to do what this did!
Thanks, hope this helps someone when google indexes it!
ooh, ooh, google keywords
MASTER CHILD GRIDVIEW DATAGRID HIERARGRID VB.NET HIERARCHICAL
!!!!!!