简体   繁体   English

带有科学符号的GridView中的DataTable(ASP .NET 4.0)

[英]DataTable in GridView with scientific notation (ASP .NET 4.0)

I have a problem, that I was hoping you could help me solve. 我有一个问题,希望您能帮助我解决。

I have this DataTable that I want displayed in a GridView. 我有要在GridView中显示的此DataTable。 That itself is not a problem. 那本身不是问题。 The problem is that I would very much like it displayed with scientific notation. 问题是我非常希望它以科学的符号显示。 It is also using "," as decimal seperator, which I would like to be "." 它还使用“,”作为小数点分隔符,我希望是“。”。 instead. 代替。

In short: I would like to go from "xxxxxx,xxxxxx" to something like "xx.xxexxx". 简而言之:我想从“ xxxxxx,xxxxxx”变为“ xx.xxexxx”。

The DataTable contains 9 values. 数据表包含9个值。 It's a 3x3 matrix I have received after calling a Matlab function (output type MWNumericArray). 这是调用Matlab函数(输出类型MWNumericArray)后收到的3x3矩阵。 I'm not even sure converting it to DataTable was the right choice in the first place. 我什至不确定首先将其转换为DataTable是正确的选择。

Thanks in advance! 提前致谢!

EDIT: BTW I'm very new to C#! 编辑:顺便说一句,我是C#的新手!

First off, you don't change formatting in the datatable, that happens on the datagridview itself. 首先,您无需更改数据表中的格式,而这会发生在datagridview本身上。

But it's quite simple to do from Visual Studios. 但是从Visual Studios进行操作非常简单。

  1. Right click the datagridview and select edit columns 右键单击datagridview并选择编辑列
  2. Go to Appearance -> DefaultCellStyle 转到外观-> DefaultCellStyle
  3. Then under CellStyle builder, under Behavior click edit on Format 然后在“单元格样式”构建器下的“行为”下,单击“格式”上的“编辑”。
  4. Select scientific 选择科学

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM