Here's the code for the web form:.. and the code behind ...Code:... <asp: DataGrid ...> <Columns> .... <asp:TemplateColumn HeaderText="Name"> <ItemTemplate> <%# Container.DataItem("name") </ItemTemplate> <EditItemTemplate> <asp:TextBox runat="server" Text='<%# Container.DataItem("custom") %>' CssClass="textbox2" ID="txtName" /> </EditItemTemplate> </asp:TemplateColumn> </Columns> </asp: DataGrid>Problem is whatever I enter into the txtName textbox in the datagrid on Editing mode and click on update (which is handled by dgAdd_UpdateCommand sub), the sub will only write the old value. For example, when the name is originally Karl Moore, and when I type in Carl More, the sub will write Karl Moore instead of Carl More. I tried disabling EnableViewState on the textbox but it still doesn't work.Code:Private Sub dgAdd_UpdateCommand(ByVal source As Object, ByVal e As DataGridCommandEventArgs) Handles dgAdd.UpdateCommand Dim strName As String Dim txtNameReplica as TextBox txtNameReplica = e.Item.Cells(1).Control(1), TextBox strName = txtNameReplica.Text Response.Write(strName) End Sub![]()




Reply With Quote