Текст не получен ввод данных
<asp:GridView ID="GridView1" Width="100%" runat="server" AutoGenerateColumns="False" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" DataKeyNames="MATIN"> <Columns> <asp:BoundField DataField="MATIN" HeaderText="STT" ReadOnly="True" /> <asp:TemplateField HeaderText="Tiêu Đề"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TIEUDE") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("TIEUDE") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Tóm Tắt"> <EditItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("TOMTAT") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Eval("TOMTAT") %>'></asp:Label> </ItemTemplate> </Columns> </asp:Gridview>
private Customer_BUS bus = new Customer_BUS(); protected void Page_Load(object sender, EventArgs e) { LoadData(); } private void LoadData() { DataTable lst = bus.GetTinTuc(); GridView1.DataSource = lst; GridView1.DataBind(); } protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { int id = int.Parse((GridView1.DataKeys[e.RowIndex].Value).ToString()); string td = (GridView1.Rows[e.RowIndex].Cells[1].Controls[1] as TextBox).Text; string tt = (GridView1.Rows[e.RowIndex].Cells[2].Controls[1] as TextBox).Text; string text = (GridView1.Rows[e.RowIndex].Cells[6].Controls[1] as TextBox).Text; FileUpload file = ((FileUpload)GridView1.Rows[e.RowIndex].FindControl("FileUpload1")); string img; int TL = int.Parse(((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList1")).SelectedValue); if (file.HasFile) { file.SaveAs(Server.MapPath("images/" + file.FileName)); img = "images/" + file.FileName; bus.UpdaterTinTuc(id, td, tt, text, img, TL); } else { bus.UpdaterTinTuc2(id, td, tt, text, TL); } GridView1.EditIndex = -1; LoadData(); } protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; LoadData(); } protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { GridView1.EditIndex = -1; LoadData(); }
Что я уже пробовал:
Мне нужны обновленные данные, но введенные данные не получены текстовым полем в Row_Editing