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
470
Add New Row Value List Style
posted

Hi,

I have a grid with an add new row as the first row in the grid: FixedAddRowOnTop - I have a ValueList in the first column. I want to allow the user to select an item and add the row to the grid. Once the row is added to the grid how do I get the value list to stop showing up in the rows that have been added. Once they add the row I do not want them to edit it. I can't seem to figure it out. The AddNewRow and the 1st row that was added have the same index of 0. The IsTemplateAddNewRow returns false in the add new row. Changing the CellActivation to NoEdit shuts off the valuelist in all the rows including the AddNewRow.

Thanks.

 

  • 469350
    Verified Answer
    Offline posted

     Hi, 

        I took a look at this and I think I got it to work like you want. It was more code than I expected it to be, though.


            private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {      
                // Disabled editing in the string 1 column
                e.Layout.Bands[0].Columns["String 1"].CellActivation = Activation.ActivateOnly;
            }

            private void ultraGrid1_InitializeTemplateAddRow(object sender, InitializeTemplateAddRowEventArgs e)
            {           
                // Enabled editing in the String 1 column just or the TemplateAddRow
                e.TemplateAddRow.Cells["String 1"].Activation = Activation.AllowEdit;
                e.TemplateAddRow.Cells["String 1"].IgnoreRowColActivation = true;
            }

            private void ultraGrid1_BeforeRowUpdate(object sender, CancelableRowEventArgs e)
            {
                // If this is an AddRow being committed, then re-disable editing in the
                // String 1 cell
                if (e.Row.IsAddRow || e.Row.IsTemplateAddRow)
                {
                    e.Row.Cells["String 1"].IgnoreRowColActivation = false;
                }
            }

        Personally, I think there probably should be an easier way.  I remember that there was a fix made in this area a while back to make this easier, but I don't remember exactly what was done. So either I can't find it or it isn't working properly.

        I recommend reporting this to Infragistics Developer Support as a potential bug.  Submit an incident to Infragistics Developer Support