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
150
Using multiple EditorControls for a single UltraWebGrid Column?
posted

I have an UltraWebGrid control in which I have a column that contains numeric data. My problem is that for a particular value in this column (the value is derived as a result of a value in another column of the same grid), is that this value needs to be formatted as a percent value. All the other values in subsequent rows for this column should be formatted as a currency value. I tried in the code-behind to set the EditorControl manually, however, the column seems to inherit the EditorControl of the last row in the grid.

Is it possible to have more than one EditorControl assigned to a specific Column in an UltraWebGrid? If so, how is it done?

  • 8160
    posted

    Hello fy8040,

    You can handle InitializeRow event and check cell’s value then apply string formatting:


        protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
        {
            //Check if the cell's value in first column is odd or even
            if ((int)e.Row.Cells[0].Value %2 == 0 )
            {
                //apply percentages formating 
                e.Row.Cells[0].Value = String.Format("{0:0%}", e.Row.Cells[0].Value);
            }
            else
            {
                //apply currency formating
                e.Row.Cells[0].Value = String.Format("{0:c}", e.Row.Cells[0].Value);
            }
           
        }
    

     


    Please let me know if my suggestion is helpful for you
    Thank you