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
215
How to determine if grid column is required (allow or not allows null)
posted

Is there a way to determine if an Ultragrid column allows or does not allow nulls. I want to change the header caption (like adding an * to caption and changing the text color) to indicate the column is required. My grids are usually connected to datatables from a dataset. I know there is an AllowNull property on the column in the datatable, but how do I determine this from the Ultragrid column?

Thanks

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Hi Lonnie,

    it's pretty easy to get to the data column from the grid column, because the keys of the columns and bands will match up - at least for the root level.

    So you could use InitializeLayout of the grid to loop through the bands and then the columns within each band. For the root band, you would get the root table with something like this:

    dataSet.Tables[gridRootBand.Key]

    Then you could index into the table's Columns collection using the same keys as the grid columns.

    For child bands, you have to index into the Relationships collection on the DataSet instead of the tables collection.

Children