Problem with DataGrid Web control in asp.net
From: Mohsen (mhsahmadi_at_hotmail.com)
Date: 11/25/03
- Next message: Richard Heathfield: "Re: Writing an Emulator"
- Previous message: Brian Inglis: "Re: Any experience with "The Last One"?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 24 Nov 2003 23:16:03 -0800
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.
another problem is in following line :
<asp:EditCommandColumn ItemStyle-Font-Name="tahoma"
HeaderStyle-BackColor="#9c9ace" HeaderStyle-ForeColor="white"
ButtonType="linkbutton" ItemStyle-Font-Size="12px" EditText="Edit"
UpdateText="Ok" CancelText="cancle"></asp:EditCommandColumn>
when i change ButtonType="Pushbutton" and run my project ,in aspx page
when click Pushbutton the page didn't post back and nothing happens.
I would be a great appreciation if you help me ...
- Next message: Richard Heathfield: "Re: Writing an Emulator"
- Previous message: Brian Inglis: "Re: Any experience with "The Last One"?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]