Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Using DataGrid for Updating

  Asked By: Kenneth    Date: Jun 06    Category: Asp.net    Views: 499
  

I have Used a datagrid to Display and Update the
database for the First Time,Till now I was Using the
datatables.I went throught Most of the samples and
Made a Page in my Project using datagrid.The Problem I
am facing now is that I am unable to retirve the
Values from the textBox on Edit command.I get the
orginal values from the text Box and not the changed
value

Code Behind


Sub dgd_Authors_Update(ByVal sender As Object, ByVal e
As DataGridCommandEventArgs)
Dim FName As TextBox =
e.Item.Cells(2).Controls(0)
Dim LName As TextBox =
e.Item.Cells(3).Controls(0)
Dim AuthorId As String = e.Item.Cells(1).Text
' Dim sqlda As New
Dim FirstName As String = FName.Text 'Here I
am not getting the Values changed in the TextBox am I
going wrong
Dim LastName As String = LName.Text ' Here
Tooo
Dim AuthorIdText As String = AuthorId

Dim Conn As Object ' SqlConnection
Dim Comm As Object ' SqlCommand
Dim DataRdr As Object ' SqlDataReader
Dim sqlQuery As String
Dim sql As String

sqlQuery = "Update Library_Author set FName =
'" & FirstName & "',LName = '" & LastName & "' where
AuthorID = " & AuthorIdText
ExecuteQuery(sqlQuery)
dgd_Authors.EditItemIndex = -1
LoadBookGrid()
End Sub

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Using DataGrid for Updating Or get search suggestion and latest updates.




Tagged: