c#从winform转webform遇到的问题,求解
GridView2.Rows[j].Cells[indexC].Text = string.Format("{0:#}", y2[j, 0]);
if (j < y2.GetLength(0) - PubVars.P_TLenth) GridView2.Rows[j].Cells[indexC + 1].Text = string.Format("{0:f}", (double.Parse(GridView2.Rows[j].Cells[1].Text.ToString()) - double.Parse(GridView2.Rows[j].Cells[indexC].Text.ToString())) / double.Parse(GridView2.Rows[j].Cells[1].Text.ToString()) * 100) + "%";
else GridView2.Rows[j].Cells[indexC + 1].Text = "";
这个时原来的webform改了一点点的代码(datagridview和girdview的差别)
现在用string.Format 老是数据格式不对
1.我现在需要这些操作在datadtble里做(GridView2》》datatable2)
2。 相应的object和数据格式搞不清楚
我更改的版本如下:
dtt.Rows[j][indexC] = string.Format("{0:#}", y2[j, 0]);
if (j < y2.GetLength(0) - PubVars.P_TLenth)
dtt.Rows[j][indexC + 1] = string.Format("{0:f}", (double.Parse(dtt.Rows[j][1].ToString()) - double.Parse(dtt.Rows[j][indexC].ToString())) / double.Parse(dtt.Rows[j][1].ToString()) * 100) + "%";
else dtt.Rows[j][indexC + 1] = "";