I am trying to set the column headers for a databound grid using
gridName[0, 1].Text = "MyColumnHeader";
It works for gridName[0,0].Text = "Test";
Is this because 0,0 is not databound?
If so, what do I need to do to set it for a databound grid?
I am on version 184.108.40.206 I think (the lates download patch).
I can read the original text though and put it in a messagebox.
I have also tried
gridName.GridBoundColumns["ColumnName"].HeaderText = "NewHeader";
gridName.GridBoundColumns.HeaderText = "NewHeader";
but get an error message at run time saying:
"An unhandled exception of type 'System.NullReferenceException' occurred in ucscheduledaycardio.dll
Additional information: Object reference not set to an instance of an object."
The problem is that the object and the data that go with it is displayed on the screen. I even tried to put this on a button just to make sure.
No luck! The code in the previous posting does not cause an error.
ADAdministrator Syncfusion Team February 23, 2003 05:50 PM
You do need to set the header text through the GridBoundColumns. But if you are getting thoses null reference exceptions, it suggests that you did not add any GridBoundColumns to your GridDataBoundGrid.
In such a case, you should use the Binder.InternalColumns that are added for you when you don't add any. So, try code such as
gridName.Binder.InternalColumns.HeaderText = "NewHeader";
KVKnut VonheimFebruary 24, 2003 02:19 PM
that worked! I must have been mistaken when I thought the GridBoundColumns were added if I bound a column to a dataset column in the designer.
Wish the documentation was a little better, but you and this forum are great alternatives!
Thanks again Clay!