Click to See Complete Forum and Search --> : Help using EditCommandColumn


Funkymonkey
09-26-2005, 06:13 AM
When I click edit, the info in the cells disappear and the textboxes are blank???

Private Sub Page_Load...
If Not Page.IsPostBack Then
SqlConnection1.Open()
SqlDataAdapter1.SelectCommand.CommandText = "SELECT * FROM info"

SqlDataAdapter1.Fill(DS, "info")

DataGrid1.DataSource = DS.Tables(0)

DataGrid1.DataBind()

SqlConnection1.Close()
End If

End Sub

Sub DataGrid1_Edit(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
DataGrid1.EditItemIndex = e.Item.ItemIndex

End Sub

Thanks loads I know I'm missing something simple...

memark
09-29-2005, 09:09 AM
Since the editing row did not exist before, it's empty. To fill it you need to rebind your data by opening the SQL connection, populating the data set etc, just like you did in Page_Load. (You might want to put all of this code into a separate Sub.)