[前台代码]
<asp:GridView ID="gvwRollMoni" runat="server" Width="100%"
AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="回滚段" HeaderText="回滚段" ReadOnly="True"
SortExpression="回滚段" />
<asp:BoundField DataField="大小(MB)" HeaderText="大小(MB)" ReadOnly="True"
SortExpression="大小(MB)" />
<asp:TemplateField HeaderText="命中率(%)" SortExpression="命中率(%)">
<ItemTemplate>
<uc1:Chart ID="Chart1" runat="server" />
<asp:Label ID="Label1" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="压缩次数(次)" HeaderText="压缩次数(次)" ReadOnly="True"
SortExpression="压缩次数(次)" />
</Columns>
<EmptyDataTemplate>
</EmptyDataTemplate>
</asp:GridView>[后台代码]void gvwRollMoni_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Separator)
{
double dblTemp = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "[命中率(%)]"));
Label templabel = e.Row.FindControl("Label1") as Label;
templabel.Text = Math.Round(dblTemp, 2) + "%";
userControl_Chart ucChart = e.Row.FindControl("Chart1") as userControl_Chart;
if (ucChart != null) ucChart.Width = Convert.ToInt32(dblTemp);
}
}这里绑定出错 数据库里面字段就是 命中率(%) 这个()要怎么格式化才行呀。高手来啊
<asp:GridView ID="gvwRollMoni" runat="server" Width="100%"
AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="回滚段" HeaderText="回滚段" ReadOnly="True"
SortExpression="回滚段" />
<asp:BoundField DataField="大小(MB)" HeaderText="大小(MB)" ReadOnly="True"
SortExpression="大小(MB)" />
<asp:TemplateField HeaderText="命中率(%)" SortExpression="命中率(%)">
<ItemTemplate>
<uc1:Chart ID="Chart1" runat="server" />
<asp:Label ID="Label1" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="压缩次数(次)" HeaderText="压缩次数(次)" ReadOnly="True"
SortExpression="压缩次数(次)" />
</Columns>
<EmptyDataTemplate>
</EmptyDataTemplate>
</asp:GridView>[后台代码]void gvwRollMoni_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Separator)
{
double dblTemp = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "[命中率(%)]"));
Label templabel = e.Row.FindControl("Label1") as Label;
templabel.Text = Math.Round(dblTemp, 2) + "%";
userControl_Chart ucChart = e.Row.FindControl("Chart1") as userControl_Chart;
if (ucChart != null) ucChart.Width = Convert.ToInt32(dblTemp);
}
}这里绑定出错 数据库里面字段就是 命中率(%) 这个()要怎么格式化才行呀。高手来啊
解决方案 »
- 一个刚进[.net]门的菜鸟疑惑
- 关于updatepanel,求高手进来看下
- xml问题
- gridview 更新问题,在线等
- 求一个url的正则表达式
- 100分求解,ASP.net中你是如何将表格导出到excel的?
- treeview绑定xml,xml是由xslt转换而来的,系统提示:根级别上的数据无效。 行 1,位置 1。
- frameset 为何不能嵌套纽约时报的新闻网页??
- ASP.NET中如何使用SQL Server 2000中的image类型的数据?(在线等)
- 我在一个ASPX文件中用了一个HtmlInputFile控件,我想在一个HtmlTextArea控件中将选择的文件打开,如何实现?
- vs2008安装失败!
- 实现自动登录邮箱
double dblTemp = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, @"[命中率(%)]"));