By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,552 Members | 927 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,552 IT Pros & Developers. It's quick & easy.

DataGrid Web Server control disappearing when handling Edit column event

P: n/a
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.
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.