C
Coleen
I've been to gotdotnet.com/quickstart...samples and reviewed the Source
control for adding paging to datagrids, my problem is that we do not connect
to an SQL Server, we are using an RPC to get the data from a DB2 database
using COBOL. It is a difficult way to get connected, and causes problems
when I'm trying to do something that's supposed to be as simple as paging
for a datagrid. When I use the code from the sample, when I select the page
number to go to, I get a blank screen, with Currentpageindex is 1 and
PageCount is 0. Why doesn't it page correctly? Here is my code...Any
suggestions?
Dim lo_AZRM001A_SEL As MotorFuel.AZRM001A_SEL
Dim lo_misc_func As MotorFuel.misc_func
Dim ds_mc As DataSet
Dim dt_mc As New DataTable()
Dim createdataview as DataView
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
uf_get_supplier_list()
End If
End Sub
Private Sub uf_get_supplier_list()
'This function gets the Withdrawal listing if available.
'Define the local variables.
Dim li_no_row As Integer = 0
Try
'Instantiate an RPC to get an Withdrawal Listing.
lo_AZRM001A_SEL = New MotorFuel.AZRM001A_SEL()
lo_misc_func = New MotorFuel.misc_func()
Catch
'Destroy the objects.
lo_AZRM001A_SEL = Nothing
lo_misc_func = Nothing
End Try
'Set the data to the Data Grid if the li_no_row is not equal "0".
If li_no_row <> 0 Then
If Page.IsPostBack = False Then
dt_mc = lo_AZRM001A_SEL.get_ddl_sel_sup
dtg_load_data()
End If
End If
'Destroy the objects.
lo_AZRM001A_SEL = Nothing
lo_misc_func = Nothing
End Sub
Private Sub btn_sel_sup_ok_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_sel_sup_ok.Click
Response.Redirect("../Common/mc_rpt_period.aspx")
End Sub
Sub dtg_load_data()
dtg_sel_sup.DataSource = dt_mc
dtg_sel_sup.DataKeyField = "BusinessID"
dtg_sel_sup.DataMember = "BusinessName"
dtg_sel_sup.DataMember = "Account"
dtg_sel_sup.DataBind()
createdataview = New DataView(dt_mc)
'Destroy the objects.
lo_AZRM001A_SEL = Nothing
lo_misc_func = Nothing
End Sub
Sub dtg_sel_sup_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)
dtg_sel_sup.CurrentPageIndex = e.NewPageIndex
bindgrid()
End Sub
Sub bindgrid()
dtg_sel_sup.DataSource = createdataview
dtg_sel_sup.DataBind()
showstats()
End Sub
Sub showstats()
lblcurrentindex.Text = "CurrentpageIndex is " &
dtg_sel_sup.CurrentPageIndex
lblpagecount.Text = "PageCount is " & dtg_sel_sup.PageCount
End Sub
control for adding paging to datagrids, my problem is that we do not connect
to an SQL Server, we are using an RPC to get the data from a DB2 database
using COBOL. It is a difficult way to get connected, and causes problems
when I'm trying to do something that's supposed to be as simple as paging
for a datagrid. When I use the code from the sample, when I select the page
number to go to, I get a blank screen, with Currentpageindex is 1 and
PageCount is 0. Why doesn't it page correctly? Here is my code...Any
suggestions?
Dim lo_AZRM001A_SEL As MotorFuel.AZRM001A_SEL
Dim lo_misc_func As MotorFuel.misc_func
Dim ds_mc As DataSet
Dim dt_mc As New DataTable()
Dim createdataview as DataView
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
uf_get_supplier_list()
End If
End Sub
Private Sub uf_get_supplier_list()
'This function gets the Withdrawal listing if available.
'Define the local variables.
Dim li_no_row As Integer = 0
Try
'Instantiate an RPC to get an Withdrawal Listing.
lo_AZRM001A_SEL = New MotorFuel.AZRM001A_SEL()
lo_misc_func = New MotorFuel.misc_func()
Catch
'Destroy the objects.
lo_AZRM001A_SEL = Nothing
lo_misc_func = Nothing
End Try
'Set the data to the Data Grid if the li_no_row is not equal "0".
If li_no_row <> 0 Then
If Page.IsPostBack = False Then
dt_mc = lo_AZRM001A_SEL.get_ddl_sel_sup
dtg_load_data()
End If
End If
'Destroy the objects.
lo_AZRM001A_SEL = Nothing
lo_misc_func = Nothing
End Sub
Private Sub btn_sel_sup_ok_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_sel_sup_ok.Click
Response.Redirect("../Common/mc_rpt_period.aspx")
End Sub
Sub dtg_load_data()
dtg_sel_sup.DataSource = dt_mc
dtg_sel_sup.DataKeyField = "BusinessID"
dtg_sel_sup.DataMember = "BusinessName"
dtg_sel_sup.DataMember = "Account"
dtg_sel_sup.DataBind()
createdataview = New DataView(dt_mc)
'Destroy the objects.
lo_AZRM001A_SEL = Nothing
lo_misc_func = Nothing
End Sub
Sub dtg_sel_sup_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)
dtg_sel_sup.CurrentPageIndex = e.NewPageIndex
bindgrid()
End Sub
Sub bindgrid()
dtg_sel_sup.DataSource = createdataview
dtg_sel_sup.DataBind()
showstats()
End Sub
Sub showstats()
lblcurrentindex.Text = "CurrentpageIndex is " &
dtg_sel_sup.CurrentPageIndex
lblpagecount.Text = "PageCount is " & dtg_sel_sup.PageCount
End Sub