Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
903
Change the data field for a column server side
posted

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 this

NewGrid.Columns(NoteCol).Key = "DueNote"

or like this

NewGrid.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.



Parents Reply Children