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
455
Add New Row and ValueList
posted

Hi,

I have a grid which display a AddNewRow row on the top of the grid to add a new row to the grid. Once of the column of the new row is a drop down so that user is restricted to select value from the list. My requirement is once the row is added the column with drop down should be not editable.

I have done few thing but not a perfect solution,

in the InitializeLayout method I set the column style as DropDownList and set it ValueList. and then in BeforeRowActivate method i added following code.

 

            if (e.Cell.Row.IsAddRow)
            {
                e.Cell.Row.Cells["COL_VLIST"].Activation = Activation.AllowEdit;
            }
            else
            {
                e.Cell.Row.Cells["COL_VLIST"].Activation = Activation.NoEdit;
            }

 

 

 

Another approached I used is in AfterRowInsert method I set the Cell ValueList, but it retain this valuelist after row is added to the grid?

What is the best way to handle this situation? Also another issue is when I am entering value in the new row anc click the down arrow the row is added to the grid, is there way so that I can validate teh value before row is added to the grid?