Is it possible to manipulate the format on a DataGridView that is bound to a Data Source?

六月ゝ 毕业季﹏ 提交于 2019-12-12 01:13:42

问题


I´m using SQL Server 2005 and Visual Studio 2008, C#.

In the data source (the SQL Server data table) I use the date format mm/dd/yyyy, however, in a forms overview (DataGridView) users would like to see a completely other format, with year, week number and day number of week (yyww,d). I´ve created an algorithm for this transformation, but can I populate the affected cells with yyww,d instead of mm/dd/yyyy? And in that case - how would I do it?

I guess I need to do it after the cells are populated, but before they are shown.

The generic question is - how do I manipulate the format of Data Source bound DataGridView cells.


回答1:


CellFormatting Event can help it... it is triggered after populating data to cell and u can format that data as per requirement in that event



来源:https://stackoverflow.com/questions/3051192/is-it-possible-to-manipulate-the-format-on-a-datagridview-that-is-bound-to-a-dat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!