Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everyone

I face a problem.I want Bind some text in a grid view column on page load.I want make some part of this text bold and large and rest is normal...How i do this exmple-
CHECK AIR COMPRESSOR CONDITIO
Must be securely mounted if not/ UNIT FAILS</pre>


thanks
Posted
Updated 25-Sep-13 1:21am
v4
Comments
BillWoodruff 25-Sep-13 9:42am    
If you want the contents of some DataGridView cells to be simply informative (i.e., they are static) when the cells are in Display Mode (i.e., not in Edit mode), then you will have to sub-class DataGridView.Cell, and Paint the Cell yourself.

I believe the necessity for custom Painting the Cell will make binding impossible, but I'm not sure about that, and that's why I am posting this as a comment, rather than a solution.

Check this out: http://stackoverflow.com/questions/13118251/how-to-paint-custom-control-on-datagridviewcell?rq=1
ErBhati 26-Sep-13 7:02am    
You are right about the static value ...but if I paint the cell of gridview it Change all data of that cell...but I want Some Text bold not Full Text of that cell

1 solution

Unfortunately the text property of Gridview cell does not support this feature. You can set the whole text as bold, Italic or a color .. but not each individual character of the string.

What you could do is write a custom usercontrol and add it to the cell. Then you should be able to do this. Sounds like a hassle, and it is .. but I don't see any other way.
 
Share this answer
 
v2
Comments
BillWoodruff 25-Sep-13 9:38am    
A UserControl can only appear in a DataGridView cell when the cell is in edit mode.
Rick van Woudenberg 26-Sep-13 8:02am    
To my recollection you can actually add custom usercontrols to an individual DataGridView cell, even in both modes. I've done it in the past.
ErBhati 26-Sep-13 7:02am    
You are right about the static value ...but if I paint the cell of gridview it Change all data of that cell...but I want Some Text bold not Full Text of that cell

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900