int index = Convert.ToInt32(e.CommandArgument.ToString());
        GridViewRow GvRow = WageAccount_gv.Rows[index];
        float c_wage = Convert.ToSingle(GvRow.Cells[3].FindControl("C_WAGE").ToString());输入字符串的格式不正确
        float c_absence_count = Convert.ToSingle(GvRow.Cells[4].FindControl("c_absence_count").ToString());
        float C_ALLOWANCE_ERRAND = Convert.ToSingle(GvRow.Cells[5].FindControl("C_ALLOWANCE_ERRAND").ToString());
        float c_bonus1 = Convert.ToSingle(GvRow.Cells[6].FindControl("c_bonus1").ToString());
        float c_bonus2 = Convert.ToSingle(GvRow.Cells[7].FindControl("c_bonus2").ToString());
        float c_bonus3 = Convert.ToSingle(GvRow.Cells[8].FindControl("c_bonus3").ToString());
        float c_deduct = Convert.ToSingle(GvRow.Cells[9].FindControl("c_deduct").ToString());
        float c_insure = Convert.ToSingle(GvRow.Cells[10].FindControl("c_insure").ToString());

解决方案 »

  1.   

    FindControl("C_WAGE").ToString()返回的是这个Control的类型.你要确定这个是什么控件假设是TextBox应该是Convert.ToSingle((TextBox)GvRow.Cells[3].FindControl("C_WAGE")).Text)其他的类似.
      

  2.   

    幕白兄  
    C_WAGE 是Gridview里的一个TemplateFiled
      

  3.   

    那你就用个控件,如Label之类的先包住它再去FindControl啦,很明显GvRow.Cells[3].FindControl("C_WAGE").ToString()返回的是空值。
      

  4.   

    楼上正解 ,不能将Control类型转换为 float类型
      

  5.   

    GvRow.Cells[3].FindControl("C_WAGE").ToString()
    返回一个conftrol
      

  6.   

    TemplateFiled到底是什么?贴出来看看?
      

  7.   

                      <Columns>
                         <asp:BoundField DataField="c_id" HeaderText="ID编号" />
                         <asp:BoundField DataField="INFO_NAME" HeaderText="所属部门" />
                         <asp:BoundField DataField="p_name" HeaderText="姓名" />
                         <asp:TemplateField HeaderText="月薪" >
                           <ItemTemplate>
                             <asp:Label ID="c_wage" runat="server"></asp:Label>
                           </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="缺勤天数">
                           <ItemTemplate>
                             <asp:Label ID="c_absence_count" runat="server"></asp:Label>
                           </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="出差补贴">
                         <ItemTemplate>
                           <asp:Label ID="C_ALLOWANCE_ERRAND"runat="server"></asp:Label>
                         </ItemTemplate>
                        </asp:TemplateField>
                         <asp:TemplateField HeaderText="奖金1">
                           <ItemTemplate>
                             <asp:Label ID="c_bonus1" runat="server"></asp:Label>
                           </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="奖金2">
                           <ItemTemplate>
                             <asp:Label ID="c_bonus2" runat="server"></asp:Label>
                           </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="奖金3">
                           <ItemTemplate>
                             <asp:Label ID="c_bonus3" runat="server"></asp:Label>
                           </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="其它扣款">
                           <ItemTemplate>
                             <asp:Label ID="c_deduct" runat="server"></asp:Label>
                           </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="社会保险">
                           <ItemTemplate>
                             <asp:Label ID="c_insure" runat="server"></asp:Label>
                           </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="操  作">
                           <ItemStyle HorizontalAlign="Center"/>
                           <ItemTemplate>
                             <asp:ImageButton ID="lb_edit" runat="server" ToolTip="保存此工资详细信息" ImageUrl="../../Images/user7_(edit)_16x16.gif" />
                             <asp:HyperLink ID="lb_mob" runat="server" ToolTip="查看详细工资信息" ImageUrl="../../Images/user7_16x16.gif"></asp:HyperLink>
                           </ItemTemplate>
                         </asp:TemplateField>
                       </Columns>
    这就是Gridview里面的Column 
      

  8.   

    原来是Label
    改成Convert.ToSingle((Label)GvRow.Cells[3].FindControl("C_WAGE")).Text) 
    其他都一样.
      

  9.   

    幕白兄 这里没得 Tex?……点不出来
      

  10.   

    Convert.ToSingle(((Label)GvRow.Cells[3].FindControl("C_WAGE")
    ).Text)