开发者

How do I use IFormatProvider with ASP.Net?

The IFormatProvider interface allows me to create a class which does custom formatting of objects as strings and can be used with e.g. string.Format.

However, there doesn't seem to be a simple way of using it with ASP.Net. For example, if I have a DataGrid I can create a BoundColumn and use its DataFormatString to say how to format it, but I can't see any way to tell it to use my IFormatProvider implementation. BoundColumn seems to be limited to the default format strings.

The best solution I've found so far is to create my own class extending DataGridColumn which essentially d开发者_StackOverflowuplicates the functionality of BoundColumn.

Is there a better way of doing it?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜