mikemardon
Programmer
Hi There
I have a problem with my Page_Load event.
If I click any of the action buttons on my datagrid (edit, delete, add new record) it refreshes the page but the grid disappears!
The only thing in common with the action button events is that they all use databind()
I have tried various things but cannot figure this one out!
Anyone got a suggestion please?
Here is the code :
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Username As String = CStr(Session("Fullname"))
If Username = "x" Or lbLoggedInAs.Text = "" Then
Response.Redirect("login.aspx")
End If
lbLoggedInAs.Text = Username
If Not (IsPostBack) Then
TheseUsers = LegUsersTable.GetAll()
DataGrid1.DataSource = TheseUsers
DataGrid1.DataKeyField = "UserID"
DataGrid1.DataBind()
Else
'datagrid disappears
End If
End Sub
I have a problem with my Page_Load event.
If I click any of the action buttons on my datagrid (edit, delete, add new record) it refreshes the page but the grid disappears!
The only thing in common with the action button events is that they all use databind()
I have tried various things but cannot figure this one out!
Anyone got a suggestion please?
Here is the code :
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Username As String = CStr(Session("Fullname"))
If Username = "x" Or lbLoggedInAs.Text = "" Then
Response.Redirect("login.aspx")
End If
lbLoggedInAs.Text = Username
If Not (IsPostBack) Then
TheseUsers = LegUsersTable.GetAll()
DataGrid1.DataSource = TheseUsers
DataGrid1.DataKeyField = "UserID"
DataGrid1.DataBind()
Else
'datagrid disappears
End If
End Sub