I have a 3 level WHDG and sorting does not seem to work. Everytime I click on a column, I get an error "Object reference not set to an instance of an object". My dataset has 3 data tables and they are linked with the correct data relations. Also the primary key on the tables are set. I spent almost a day troubleshooting but no luck. I would appreciate someones help!
Hello Ram ,
I am glad that you have solved your issue .
ClearDataSource() is used when you are setting different data source.
For example if you have changed your datasource before assigning the new DataSource
you should invoke ClearDataSource() .
When you are setting DataSource because of the standard procedure needed by
WebHierarchicalDataGrid, than you do not need to invoke ClearDataSource().
Let me know if you need further assistance.
Removing ClearDataSource() solved the problem now. Thank you.
I have a question - when to use ClearDataSource() and when not to?
Hello Ram,
It depends on the situation if you should invoke ClearDataSource() or not.
In the referenced by you case it was the solution of your issue.
But in this case you do not need to clear the data source.
This is causing the issue because
if you clear data source every time you cannot sort the data .
If you need further assistance regarding this please let us know.
I modifed the sample to read from an XML file into the dataset. You can use this sample to reproduce my behaviour. I would appreciate if you could provide an alternate solution for the problem.
I clear the DataSource as suggested by Lyuba. Earlier I used to get a different error - "Multiple controls with the same ID '400_0' were found. FindControl requires that controls have unique IDs." Reference for the suggestion - http://community.infragistics.com/forums/p/46544/250803.aspx#250803
I was not able to run your sample because of the missing datasource dependency
I took a look at the code snippet and I have suspicion that clearing DataSource every time can be the cause of the issue.
Can you please try to remove the invocation?
Also an isolated sample will be appreciated.
Thank you.