Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid vanishing!

Status
Not open for further replies.

mikemardon

Programmer
May 23, 2005
71
GB
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
 
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

TheseUsers = LegUsersTable.GetAll()
DataGrid1.DataSource = TheseUsers
DataGrid1.DataKeyField = "UserID"
DataGrid1.DataBind()
End Sub
 
Thanks for the reply, it did make some difference in that the datagrid does not disappear now, but the buttons don;t seem to get actioned - ie. nothing changes when I hit edit or delete.

It seems to be reloading the default view again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top