Hi,

I’m trying to use Datagrid edit feature. When I press Edit button Datagrid shows Update and Cancel buttons, but I still can’t see text boxes. Please take a look at my code and say where is the problem.

P. S. Sorry for my English



VB Code:
  1. Dim cSQConnection As SqlConnection
  2.     Dim cSqlCommand As SqlCommand
  3.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  4.         If Not Page.IsPostBack Then
  5.             BindData()
  6.         End If
  7.     End Sub
  8.     Sub BindData()
  9.         cSQConnection = New SqlConnection("server=MySQLServer;database=MyDatabase;")
  10.         cSQConnection.Open()
  11.         cSqlCommand = New SqlCommand("SELECT * FROM Projects", cSQConnection)
  12.         DataGrid1.DataSource = cSqlCommand.ExecuteReader()
  13.         DataGrid1.DataBind()
  14.     End Sub
  15.     Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
  16.         DataGrid1.EditItemIndex = e.Item.ItemIndex
  17.         BindData()
  18.     End Sub