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
295
Unable to write new value to unbound column.
posted

I have agrid with an unbound column.  The column is of type string, and is defined inthe grid_init method.  Then in th einit_row I set an initial value, which works.  But then in code I need to change the value, but it does not change.  Can anyone tell me why.  I am sure it is something obvious.

Please see my code below

//From grid_Initialize method

if (!e.Layout.Bands[0].Columns.Exists("Desc"))
{
   e.Layout.Bands[0].Columns.Add("Desc");
}

foreach (var col in e.Layout.Bands[0].Columns)
{
   switch (col.Key)
   {
       case @"Desc":
          col.Header.Caption = "Description";
          col.Header.VisiblePosition = 0;
          col.DataType = Type.GetType("System.String");
          col.DefaultCellValue = "";
          break;

       case PoSModifierItem.UnitCostField:
          col.Header.Caption = "Price"; 
          col.Format = "c";
          col.Header.VisiblePosition = 1;
          break;

       default:
          col.Hidden = true;
          break;
   }
}


private void _ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
{
    e.Row.Cells["Desc"].Value = e.Row.Cells[PoSModifierItem.DescriptionField].Value;
}


private void _cmdApply_Click(object sender, EventArgs e)
{
    foreach (var row in _ultraGrid1.Selected.Rows)
    {
        switch ((int)_txtAdjustment.Value)
        {
            case 0:
                row.Cells["Desc"].Value = row.Cells[PoSModifierItem.DescriptionField].Value;
                break;
            case 1:
                row.Cells["Desc"].SetValue(String.Format("{0}{1}", "Light ", row.Cells[PoSModifierItem.DescriptionField].Value), false);
                break;
        }
    }
}

 

Parents
  • 71886
    Offline posted

    Hello,

    Could you please clarify what are '_txtAdjustment' and 'PosModifierItem' or either if possible try to attach a small sample project reproducing your issue. I will be happy to take a look at it.

    Please do not hesitate to contact us if you need any additional assistance.

Reply Children