Cells[3]的定义: <asp:TemplateField HeaderText="Input Qty" Visible=true >
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
<span style="height: 10px">
<asp:Label ID="lblInQty" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.input_qty") %>'>
</asp:Label></span>
</ItemTemplate>
</asp:TemplateField>
RowDataBound事件:
protected void grdYield_RowDataBound(object sender, GridViewRowEventArgs e)
{
Int32 nIn = 0;
if ((e.Row.RowIndex >=0)&&(e.Row.RowType == DataControlRowType.DataRow))
{
nIn = nIn + Convert.ToInt32(e.Row.Cells[3].Text); }
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[4].Text = nIn.ToString();
}
}帮忙看下为什么Convert.ToInt32(e.Row.Cells[3].Text)的值一直是空的,可是实际上是有值的
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
<span style="height: 10px">
<asp:Label ID="lblInQty" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.input_qty") %>'>
</asp:Label></span>
</ItemTemplate>
</asp:TemplateField>
RowDataBound事件:
protected void grdYield_RowDataBound(object sender, GridViewRowEventArgs e)
{
Int32 nIn = 0;
if ((e.Row.RowIndex >=0)&&(e.Row.RowType == DataControlRowType.DataRow))
{
nIn = nIn + Convert.ToInt32(e.Row.Cells[3].Text); }
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[4].Text = nIn.ToString();
}
}帮忙看下为什么Convert.ToInt32(e.Row.Cells[3].Text)的值一直是空的,可是实际上是有值的
解决方案 »
- 通过socks代理获取网页的C#源码有错误,哪位网位能帮忙找出错误修改成可用的,酬谢100元(帮忙看下这源码哪错了。谢谢)
- 求助连接数据库的问题
- WORD类下拉列表框
- 拯救段国富行动火热进行中
- 一个解决方案里有多个项目,其中一个项目里引用dll在从另外的解决方案里项目。如何调试?
- 新手求救!谢谢了!索引超出范围。必须为非负值并小于集合大小。参数名: index
- 关于c# 调用非托管dll的问题
- web和winfrom实现竖排文字的输入
- 求教用socket连接商用web服务器的问题?急 急 急!
- 关于组件应用问题,请各位斑竹、高手援助!
- 请教,VisualStudio是否支持调试中解释运行?
- C# winfrom 父子窗体
{
Label labelText=(Label)e.Row.FindControl("lblInQty");
nIn = nIn + Convert.ToInt32(labelText.Text); } 这样就对了
在问个问题,我想把lblSN.Text=0.01556的格式改为1.55% 改怎么写啊,我只知道GridView中的{0:N2}