Gridview中不能编辑
lqhly 2009-07-01 05:28:12 我有一个Gridview,最下面用一个添加按钮,我想把添加、编辑、删除于一体,输入内容后,点添加后,Gridview绑定数据,但点编辑后,更新和取消按钮出来后,编辑要修改的内容时,不能改动,请帮我看看问题出现在那里。前台代码为:
<asp:GridView ID="GridView1" ShowFooter="true" BorderColor="Black" CellPadding="4" OnRowDataBound="GridView1_RowDataBound" OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing"
OnRowUpdating="GridView1_RowUpdating" runat="server" AutoGenerateColumns="False" Font-Size="12px" Width="674px" AllowSorting="True">
<Columns>
<asp:TemplateField HeaderText="起始日期:">
<ControlStyle Width="100px" />
<ItemTemplate>
<asp:Label ID="Zlfkmx_t_Qsrq" runat="server" Text='<%# Bind("Qsrq") %>' ></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="Zlfkmx_t_Qsrq_txt" runat="server" onClick="Fcalendar(this)"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="截至日期:">
<ControlStyle Width="100px" />
<ItemTemplate>
<asp:Label ID="Zlfkmx_t_Jzrq" runat="server" Text='<%# Bind("Jzrq") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="Zlfkmx_t_Jzrq_txt" runat="server" onClick="Fcalendar(this)"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="租金(元)">
<ControlStyle Width="280px" />
<ItemTemplate>
<asp:Label ID="Czje" runat="server" Text='<%# Bind("Czje") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="Czje_txt" runat="server" Width="80px">0.00</asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator6" runat="server" ControlToValidate="Czje_txt"
CssClass="Text" ErrorMessage="格式不正确!" ValidationExpression="^(-?\d+)(\.\d+)?$"></asp:RegularExpressionValidator>
<asp:Button ID="btnAdd" runat="server" Text="添 加" OnClick="btnAdd_Click" />
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="编辑" ShowEditButton="True" />
<asp:CommandField HeaderText="删除" ShowDeleteButton="True" />
</Columns>
<HeaderStyle BackColor="Azure" Font-Size="12px" HorizontalAlign="Center" />
<RowStyle HorizontalAlign="Center" />
<PagerStyle HorizontalAlign="Center" />
</asp:GridView>