Created By
DMG Development
As Seen On

Main Page  |  Forums  |  Register  |  Active Topics  |  Members  |  Search

 
Username:
Password:
DMG Forums >> DMG Forums Discussion >> General Discussion >> Regarding the code in Global.VB
Regarding the code in Global.VB
Author Topic
Sandeep


Beginner

Join Date: 11/10/2008
Posts: 26

Posted: 2/12/2009 1:14:03 AM

Hi Admin,

I have designed a page in aspx and placed a gridview in it, and I have written the code in GLOBAL.VB like this:

Public Class Carrers
Inherits System.Web.UI.UserControl

Public gvCareers As System.Web.UI.WebControls.GridView
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Page.IsPostBack = False Then
BindGrid()
gvCareers.Columns(0).ItemStyle.Wrap = True
End If
End Sub
Sub BindGrid()
Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT * from Careers", New SqlConnection("Server=AD03;Database=Links;User Id=sa; Password=sa"))
Dim ds As DataSet = New DataSet()
da.Fill(ds)
gvCareers.DataSource = ds
gvCareers.DataBind()
End Sub

Sub gvCareers_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
BindGrid()
End Sub
Sub gvCareers_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs)
gvCareers.PageIndex = e.NewPageIndex
End Sub
End Class

I have generated the DLL's after updating GLOBAL.VB.
However the data is not getting displayed in the GRIDVIEW after the page gets loaded.

Could you please go through the code above and let me know where I am going wrong. So that could help me to resolve the issue.

Thanks and Regards

Sandeep

grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 2/12/2009 9:25:24 AM

Are you importing this user control into an already existing .aspx page or are you trying to create a new .aspx page?
Sandeep


Beginner

Join Date: 11/10/2008
Posts: 26

Posted: 2/12/2009 10:33:21 PM

I am creating a new ASPX Page!!!!

grimmeissen


Administrator


Join Date: 8/30/2005
Posts: 656
Location: Cincinnati, Ohio

Posted: 2/13/2009 7:41:55 AM

Well, your code inherits the UserControl class rather than the Page class, so you are not going to get the functionality to launch this in an individual page. I'm assuming you copied the class structure from Login, Header, or Settings in Global.vb?

All of the code in Global.vb is either backend functions or user controls that are embedded into other aspx pages. Take a look at how the code is done in one of the other files like DMG.vb to see how it is setup for pages rather than user controls.

  Copyright DMG Development DMG Forums 3.2