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:
Dim cSQConnection As SqlConnection Dim cSqlCommand As SqlCommand Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then BindData() End If End Sub Sub BindData() cSQConnection = New SqlConnection("server=MySQLServer;database=MyDatabase;") cSQConnection.Open() cSqlCommand = New SqlCommand("SELECT * FROM Projects", cSQConnection) DataGrid1.DataSource = cSqlCommand.ExecuteReader() DataGrid1.DataBind() End Sub Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand DataGrid1.EditItemIndex = e.Item.ItemIndex BindData() End Sub




Reply With Quote