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
220
Highlight the part of the text in UltraGridCell
posted

Hi

Please find below the code which i am using to highlight the part of the text in the UltraGridCell at runtime based on the text entered in the TextEditor, below code works fine for strings, but when i type in integer 1 in the texteditor i am getting an error "Cannot convert string to Integer"

As far as my knowledge goes in the below code since i am using Replace() with the html code in it, i assume this is not able to convert to integer which is why i get the error..

public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
{
            UltraGridCell aCell;
            
   
         Font font = this.ultraGrid1.Font;
           
            switch (drawPhase)
            {
                case DrawPhase.AfterDrawForeground:

          //Get a reference to the cell
 
          aCell = (UltraGridCell)drawParams.Element.SelectableItem;
 
          aCell.Activation = Activation.ActivateOnly;
 

                 if (aCell.Value.ToString().Contains(ultraTextEditor1.Text.Trim()))
                 {
                     aCell.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText;
                                               
                     string formattedText = aCell.Text.Replace(ultraTextEditor1.Text.Trim().ToString(), "<b>" + ultraTextEditor1.Text.Trim() + "<b>");
                     aCell.Value = formattedText;
                }
             break;
          }
}

Please help me to overcome this problem..

Thanks

Manoj

 

 

Parents Reply Children
No Data