I am using VB to implement a code behind class for an
ASP.NET form. I am loading a DataGrid web server control
with data from a table in a SQL database. the code is as
follows:
Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then
Dim con As SqlConnection = New SqlConnection
("server=(local);Integrated
Security=SSPI;database=InventoryManagement")
' Dim currentCursor As
System.Cursof = Cursor.Current
Dim dsSched As DataSet = New DataSet
'
' load the grid with preliminary scheduling
information
'
' show wait cursor
' Cursor.Current = Cursors.WaitCursor
Dim daSched As SqlDataAdapter = New
SqlDataAdapter("Select * from Schedule", con)
' daSched.FillSchema(dsSched,
SchemaType.Source, "Schedule")
daSched.Fill(dsSched, "Schedule")
' AddHandler dsSched.Tables
("Schedule").RowChanging, New DataRowChangeEventHandler
(AddressOf Row_Changing)
Dim col As System.Data.DataColumn
For Each col In dsSched.Tables
("Schedule").Columns
col.ReadOnly = False
Next
InputGrid.DataSource = dsSched
InputGrid.DataMember = "Schedule"
InputGrid.DataBind()
' restore cursor
'Cursor.Current = currentCursor
con.Close()
End If
End Sub
Here is the Edit command handler:
Private Sub InputGrid_EditCommand(ByVal source As Object,
ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs )
Handles InputGrid.EditCommand
InputGrid.EditItemIndex = e.Item.ItemIndex
InputGrid.DataBind()
End Sub
when this code is run, the page refreshes and the grid is
not rendered on the screen. am i missing something? i
tried setting all the columns to read/write, but this did
not help.