aspx_professional thread: Datagrid update problem...
Do you bind your data in the Page_Load event? If so, does the databinding
only take place when IsPostBack is False?
When you bind the data without checking for IsPostBack, the "old" database
data gets bound to the control, right before the update code executes.
HtH
Imar
> Hi friends,
> I want to update datagrid's data on click of update. I have written
> below
> code...
> ===========================================================
> Private Sub dgUser_UpdateCommand(ByVal source As Object, ByVal e As
> System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
> dgUser.UpdateCommand
> Dim txtLoginID As TextBox = e.Item.Cells(1).Controls(0)
> Dim txtCustID As TextBox = e.Item.Cells(2).Controls(0)
> Dim txtCustName As TextBox = e.Item.Cells(3).Controls(0)
> Dim strSql As String
> Dim objUser As New NexUserCls()
>
> 'txtLoginID = e.Item.Cells(1).Controls(0)
> 'txtCustID = e.Item.Cells(2).Controls(0)
> 'txtCustName = e.Item.Cells(3).Controls(0)
> mintPK = dsUserList.Tables("UserList").Rows(e.Item.ItemIndex)
> ("intPK")
>
> If objUser.fncUpdateUser(Trim(txtLoginID.Text), Trim
> (txtCustID.Text), Trim(txtCustName.Text), mintPK) = True Then
> End If
> dgUser.EditItemIndex = -1
> mintPK = 0
> subDisplayUsers()
> End Sub
>
> ===========================================================
>
> but the problem is it is not updating the data, because
> txtLoginID.Text.... is comming as old data(not modified data) even if i
> have modified data.
>
> if anybody knows cause and solution for this mail me..
> Thankx in advance
> Ramprasad
> ---