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:
Please help me to overcome this problem..
Thanks
Manoj
Hi Manoj,
I'm a little puzzled by what you are doing here. Setting properties on the cell inside a DrawFilter is probably not a good idea. It's certainly not very efficient. It seems like you should be setting properties like Activation, Style, and Value of the cell inside the InitializeLayout or InitializeRow events.
But this code will not work correctly in any case, for a couple of reason. First, you are trying to set the Value of an integer cell to a string and that won't work. Second, because you are losing the original value of the cell. If this code fires twice you will end up added addition bold tags to it every time, and you will never clear these tags.
What I would do is hide your integer column with the "real" value in it and then display an unbound string column to the user. I would use the InitializeRow event to get the value of the real column, convert it into a string, modify it however you like, and the set the Value on the unbound column.
Hello Mike,
Thanks for the reply...Its my mistake i did not remove the lines like Activation and style for the code, i agree it has to be in InitializeRow...
Many of the article says we can achieve highlighting the Text using simple FormattedText., so i was experimenting using FormattedText,
For instance i have a ID columns with values
ID
123
1235
1234556
say i want to format the text in the column to change the appearance of the digit 55 to bold using Formatted Text..
if you can please provide the sample for highlighting the text for the integer column it would be really helpful..