The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I am trying to set the column headers for a databound grid using
gridName[0, 1].Text = "MyColumnHeader";
in C#.
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 1.5.1.6 I think (the lates download patch).
I can read the original text though and put it in a messagebox.
Thanks,
Knut
I have also tried
gridName.GridBoundColumns["ColumnName"].HeaderText = "NewHeader";
gridName.GridBoundColumns[1].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.
Thanks again!
Knut
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[1].HeaderText = "NewHeader";
KVKnut VonheimFebruary 24, 2003 02:19 PM
Clay,
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!
Cheers,
Knut