OK, Im finished pulling my hair out and now I need help. I have created
a VB class file for my custom paging, in it I create a table with 2
rows, in the rows I have linkbuttons for first page, previous page,
next page and last page. The buttoms are created like:
CODE
'configure the link buttons
link_1.ID = "f_link"
link_2.ID = "p_link"
link_3.ID = "n_link"
link_4.ID = "l_link"
link_1.Text = "<< First"
link_2.Text = "< Prev"
link_3.Text = "Next >"
link_4.Text = "Last >>"
link_1.CommandA rgument = "FirstPage"
link_2.CommandA rgument = "PreviousPa ge"
link_3.CommandA rgument = "NextPage"
link_4.CommandA rgument = "LastPage"
AddHandler link_1.Command, AddressOf link_click
AddHandler link_2.Command, AddressOf link_click
AddHandler link_3.Command, AddressOf link_click
AddHandler link_4.Command, AddressOf link_click
link_1.CausesVa lidation = False
link_2.CausesVa lidation = False
link_3.CausesVa lidation = False
link_4.CausesVa lidation = False
in the class file I have serveral properties :
CODE
Public Property DG_Name() As String
Get
Return DGname
End Get
Set(ByVal value As String)
DGname = value
End Set
End Property
Public Property page_num() As Integer
Get
Return my_page
End Get
Set(ByVal value As Integer)
my_page = value
End Set
End Property
Public Property tot_records() As Integer
Get
Return total_records
End Get
Set(ByVal value As Integer)
total_records = value
End Set
End Property
Public Property MyDG() As DataGrid
Get
Return DG
End Get
Set(ByVal value As DataGrid)
DG = value
End Set
End Property
and the variables are declared here:
CODE
Public DG As DataGrid = New DataGrid
Public my_page As Integer
Public total_records As Integer
Public DGname As String
The link_click event is as such:
CODE
Public Sub link_click(ByVa l sender As Object, ByVal e As
CommandEventArg s)
Dim lb As LinkButton = CType(sender, LinkButton)
Select Case lb.CommandArgum ent.ToString.To Lower
Case "firstpage"
DG.CurrentPageI ndex = 0
HttpContext.Cur rent.Response.W rite("you clicked " &
lb.CommandArgum ent.ToString)
Case "previouspa ge"
If DG.CurrentPageI ndex = 0 Then
DG.CurrentPageI ndex = 0
Else
DG.CurrentPageI ndex = page_num - 1
End If
HttpContext.Cur rent.Response.W rite("you clicked " &
lb.CommandArgum ent.ToString)
Case "nextpage"
HttpContext.Cur rent.Response.W rite(tot_record s & "
:: " & my_page & " :: ")
If (total_records - 1) < page_num Then
DG.CurrentPageI ndex = 0
Else
DG.CurrentPageI ndex = page_num + 1
End If
HttpContext.Cur rent.Response.W rite("you clicked " &
lb.CommandArgum ent.ToString)
Case "lastpage"
HttpContext.Cur rent.Response.W rite("you clicked " &
lb.CommandArgum ent.ToString)
DG.CurrentPageI ndex = CType((DG.PageC ount),
Integer)
End Select
End Sub
The response.writes work and tell me what I clicked, in the .aspx.vb
file I set the properties in the class file as such:
CODE
page.my_page = bud_pricing.Cur rentPageIndex
name.DG_Name = "bud_pricin g"
records.total_r ecords = Rec_Count
DG.DG = bud_pricing
The values set in the aspx.vb file arent getting to the class file so
the paging dont work. The links show up beautifully but they dont page.
Can someone PLEASE help me?