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());
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());
C_WAGE 是Gridview里的一个TemplateFiled
返回一个conftrol
<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
改成Convert.ToSingle((Label)GvRow.Cells[3].FindControl("C_WAGE")).Text)
其他都一样.
).Text)