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

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
' Dim currentCursor As
System.Cursof = Cursor.Current

Dim dsSched As DataSet = New DataSet

' load the grid with preliminary scheduling
' 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
col.ReadOnly = False
InputGrid.DataSource = dsSched
InputGrid.DataMember = "Schedule"
' restore cursor
'Cursor.Current = currentCursor
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
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.