开发者

How do I use IFormatProvider with ASP.Net?

开发者 https://www.devze.com 2023-02-26 11:02 出处:网络
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.

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

精彩评论

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