I have a dataGrid in aspx page for editing my database , in OnUpdateCommand event of datagrid i have a simple code as follow : ''---------------------------------------------------------------------------------------------------- Sub dgrd_update(ByVal s As
Object, ByVal e As DataGridCommandEventArgs) Dim conMyData As OleDbConnection Dim cmdUpdate As OleDbCommand Dim strUpdate As String Dim News1_txt, News_txt, iDate_txt As TextBox News1_txt = e.Item.FindControl("News1_txt") News_txt = e.Item.FindControl("News_txt")
iDate_txt = e.Item.FindControl("iDate_txt") conMyData = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db\fnew.mdb") & ";") strUpdate = "Update fnews SET news1=@nw1 WHERE (idd=r1)" cmdUpdate = New OleDbCommand(strUpdate,
conMyData) cmdUpdate.Parameters.Add("@nw1", News1_txt.Text) cmdUpdate.Parameters.Add("r1", e.Item.Cells(0).Text) conMyData.Open() cmdUpdate.ExecuteNonQuery() conMyData.Close() Dgrd_Bnk.EditItemIndex = -1 BindDataGrid() End Sub ''------------------------------------------------------------------------------------------
but in News1_txt = e.Item.FindControl("News1_txt") , i can't get the value of textBox and News1_txt.text , return to me the value of datagrid cell befor editing it. I would be a great appreciation if you help me ...
mhsahmadi
Member
25 Points
5 Posts
Accessing to Data gride cells
Nov 24, 2003 11:43 AM|LINK