Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > sorting datagrid with richtextbox cell
 

sorting datagrid with richtextbox cell

Hi i have followed the following article to display rtb in a datagridview,

http://www.codeproject.com/KB/grid/RtfInDataGridView.aspx?msg=3164167#xx3164167xx

but i face a problem when i want to sort the column.

Is there a way to sort the column?

normally when u click on the header of a column, the datagrid will sort according, but i find that for the rtb column, it doesn't work.

pls advice...

dafeizhu  Tuesday, August 18, 2009 8:33 AM

Aland Li

Hi dafeizhu,

I have tested the code, the first column cannot be sorted, but the second column can be. It is because the SortMode property of the first column is NotSortable. We can set the SortMode property to Automatic have the column sortable. This is the code:
this.Column1.SortMode = DataGridViewColumnSortMode.Automatic;

Let me know if this helps.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Thursday, August 20, 2009 5:51 AM

Aland Li

Hi dafeizhu,

I have tested the code, the first column cannot be sorted, but the second column can be. It is because the SortMode property of the first column is NotSortable. We can set the SortMode property to Automatic have the column sortable. This is the code:
this.Column1.SortMode = DataGridViewColumnSortMode.Automatic;

Let me know if this helps.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Thursday, August 20, 2009 5:51 AM

You can use google to search for other answers

Custom Search

More Threads

• help: can't leave databound combobox after selecting a value.
• AddNew() creates a new row but I can't navigate to it
• Master-detail databinding with Linq
• Combo Box Columns
• asp.net c# .DataSource, .DataMember, .DataTextField, .DataValueField, .DataBind
• Formview navigating to a particular record
• JIT
• Two Windows Application, single Database.
• how to check is specific software is installed or not using java code
• Determine which control caused CurrencyManager.CurrentChanged event?