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
55
Assigning default value for unbounded column
posted

Hi,

I am tring to add an unbounded column of edit buttons to a grid.

the assignment to the grid DataSource happends at runtime, and the rows attached there don't contain the defaultCellValue i wanted for these buttons (their buttons has no caption).

I tried to assign it manualy right after the binding:

private void InitData()

{

     this.ultraGrid.DataSource = this.innerMultiDropDownValues.Values;

     //foreach (UltraGridRow row in ultraGrid.Rows)

          // row.Cells[editBtnColumnKey].Value = this.ultraGrid.DisplayLayout.Bands[0].Columns[editBtnColumnKey].DefaultCellValue;

}

But i got an exception because the Cells property for all the rows is null, although the DataSource is valid.

Can u please help me solve this issue, and also explain to me how to handle a mixture of bounded and unbounded columns?

Parents
No Data
Reply
  • 469350
    Offline posted

    Are you sure Cells is null? The Cells collection should never be null. Although it's certainly possible that the unbound column does not yet exist. 

    If you want a button in an unbound column with some text on it, the best way to do to it is to add the unbound column to the grid in the grid's InitializeLayout event. To set the text on the button, you should use the InitializeRow event and do something like this:

    if (e.ReInitialize == false)

    {

     e.Row.Cells["my unbound button column"].Value = "The text I want on the button";

    }

Children