I have a grid bound to a WebHierarchichalDataSource. I want to change the data field that one column is bound to according to a users choice.
I have tried setting the data field for the column like thisNewGrid.Columns(NoteCol).Key = "DueNote"or like thisNewGrid.GridView.Columns(NoteCol).Key = "DueNote"
And I either see no change or the error "Object reference not set to an instance of an object". I have tried setting the value in various places during DataBind and in Data_bound but get the same error.I feel I need to set the DataFieldName for the column but DataFieldName is not a member of Columns (although it appears to be in the designer) and I can find no way to set this server side.
Hello nickhoare,
Please let us know if you have further questions.
Hi,
Before calling refresh behaviors, could you try making the changes to the Columns on the WHDG itselft,too? And another option would be to try to create sorting on the GridView itself. Then you shouldn't need to call RefreshBehaviors().
-Dave
I am trying
NewGrid.Behaviors.Add(NewGrid.Behaviors.CreateBehavior(Of Infragistics.Web.UI.GridControls.Sorting)) NewGrid.Behaviors.Sorting.Enabled = True NewGrid.RefreshBehaviors()And this seems to do something, it is just that the grid appears 'pre-sorted' on a particular column and and clicking on the headers results in the ajax activity indicator working but the grid does not sort.The above syntax for creating a behavior is completely new to me.
I do that already. What I am now trying is to add the sorting behaviour after I have rebuilt the grid.
Hmm, maybe trying clearing the Records on the GridView and rebinding the WHDG to make sure your changes are carried to the grid?