在gridveiw中源为:
 <Columns>
 <asp:CommandField ShowEditButton="True" />
  <asp:BoundField  DataField="ntc_id" />
 <asp:TemplateField>
 <EditItemTemplate>
 <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ntc_title") %>'></asp:TextBox>
 <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
Display="Dynamic" ErrorMessage="*"></asp:RequiredFieldValidator>
 </EditItemTemplate>
 <ItemTemplate>
 <asp:Label ID="Label1" runat="server" Text='<%# Bind("ntc_title") %>'></asp:Label>
 </ItemTemplate>
 </asp:TemplateField>
 <asp:BoundField  DataField="substr(ntc_content,1,20)"/>
  <asp:BoundField  DataField="ntc_publishdate"/>
 </Columns> 
后台为:
 protected void GV_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {    int ntc_id = Convert.ToInt32(((TextBox)(GV.Rows[e.RowIndex].Cells[2].Controls[0])).Text);
         string Title = ((TextBox)(GV.Rows[e.RowIndex].Cells[3].Controls[0])).Text;
         string Content = ((TextBox)(GV.Rows[e.RowIndex].Cells[4].Controls[0])).Text;
         string Date = ((TextBox)(GV.Rows[e.RowIndex].Cells[5].Controls[0])).Text;
        
 command.CommandText = "update th_notice set ntc_title='" +e.NewValues+ "',ntc_content='" + Content + "',ntc_operator='" + "aaa" + "',ntc_publishdate='" + Date + "'  where  ntc_id='" + ntc_id + "'";
             command.ExecuteNonQuery();
             GV.EditIndex = -1;
             GetGVData();
    }
不加验证控件之前,编辑后正确更新,当加入验证控件后,提示无法将类型为“System.Web.UI.LiteralControl”的对象强制转换为类型“System.Web.UI.WebControls.TextBox”,我将((TextBox)(GV.Rows[e.RowIndex].Cells[3].Controls[0])).Text改为((Label)(GV.Rows[e.RowIndex].Cells[3].Controls[0])).Text还是不正确,请大侠帮忙,已经困扰我好久啦。