473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Datagrid Paging not working

Sorry about the multi-posting, but it does not seem as though the other
newsgroups are frequented enough to get any advice on this problem...If
anyone can possibly help, I would greatly appreciate it, I've spent three
days trying figure out why paging won't work for me...TIA.

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 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

Nov 18 '05 #1
4 1493
you need to re-populate createdataview in your databind()
method. Otherwise, it has no data in it.

Tu-Thach
-----Original Message-----
Sorry about the multi-posting, but it does not seem as though the othernewsgroups are frequented enough to get any advice on this problem...Ifanyone can possibly help, I would greatly appreciate it, I've spent threedays trying figure out why paging won't work for me...TIA.

I've been to gotdotnet.com/quickstart...samples and reviewed the Sourcecontrol for adding paging to datagrids, my problem is that we do not connectto an SQL Server, we are using an RPC to get the data from a DB2 databaseusing COBOL. It is a difficult way to get connected, and causes problemswhen I'm trying to do something that's supposed to be as simple as pagingfor a datagrid. When I select the page number to go to, I get a blankscreen, with Currentpageindex is 1 and PageCount is 0. Why doesn't it pagecorrectly? 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 AsSystem.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 AsSystem.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.PageCountEnd Sub

.

Nov 18 '05 #2
So here - I need to do something like this?
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"
createdataview = New DataView(dt_mc)
dtg_sel_sup.DataBind()

I'm not really sure, since I had already re-bound the datagrid only
difference is that I changed the position of the databind. I'm having
trouble getting a connection to our database right now, so I can't test it.
If this is not what you meant, could you please give me an example? Thanks
very much for the assistance :-)

Coleen


"Tu-Thach" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
you need to re-populate createdataview in your databind()
method. Otherwise, it has no data in it.

Tu-Thach

Nov 18 '05 #3
Look at your function for handling page change, you have

Sub dtg_sel_sup_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)
dtg_sel_sup.CurrentPageIndex = e.NewPageIndex
bindgrid()
End Sub

which calls bindgrid() to bind your datagrid. The
bindgrid method:

Sub bindgrid()
dtg_sel_sup.DataSource = createdataview
dtg_sel_sup.DataBind()
showstats()
End Sub

In this method, you set the datasource for your grid to
the variable createdataview. Nowhere in this code did you
initialize data for the variable createdataview.
Therefore, when you bind the datagrid, it does not have
any data and that's why the datagrid shows nothing. You
need to do something similar to your dtg_load_data()
method.

Tu-Thach
-----Original Message-----
So here - I need to do something like this?
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"
createdataview = New DataView(dt_mc)
dtg_sel_sup.DataBind()

I'm not really sure, since I had already re-bound the datagrid onlydifference is that I changed the position of the databind. I'm havingtrouble getting a connection to our database right now, so I can't test it.If this is not what you meant, could you please give me an example? Thanksvery much for the assistance :-)

Coleen


"Tu-Thach" <an*******@discussions.microsoft.com> wrote in messagenews:02****************************@phx.gbl...
you need to re-populate createdataview in your databind () method. Otherwise, it has no data in it.

Tu-Thach

.

Nov 18 '05 #4
Umm, I totally missed that - Thanks! I guess that's what happens when you
try to do too much multi-tasking...

"Tu-Thach" <an*******@discussions.microsoft.com> wrote in message
news:07****************************@phx.gbl...
Look at your function for handling page change, you have

Sub dtg_sel_sup_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)
dtg_sel_sup.CurrentPageIndex = e.NewPageIndex
bindgrid()
End Sub

which calls bindgrid() to bind your datagrid. The
bindgrid method:

Sub bindgrid()
dtg_sel_sup.DataSource = createdataview
dtg_sel_sup.DataBind()
showstats()
End Sub

In this method, you set the datasource for your grid to
the variable createdataview. Nowhere in this code did you
initialize data for the variable createdataview.
Therefore, when you bind the datagrid, it does not have
any data and that's why the datagrid shows nothing. You
need to do something similar to your dtg_load_data()
method.

Tu-Thach
-----Original Message-----
So here - I need to do something like this?
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"
createdataview = New DataView(dt_mc)
dtg_sel_sup.DataBind()

I'm not really sure, since I had already re-bound the

datagrid only
difference is that I changed the position of the

databind. I'm having
trouble getting a connection to our database right now,

so I can't test it.
If this is not what you meant, could you please give me

an example? Thanks
very much for the assistance :-)

Coleen


"Tu-Thach" <an*******@discussions.microsoft.com> wrote in

message
news:02****************************@phx.gbl...
you need to re-populate createdataview in your databind () method. Otherwise, it has no data in it.

Tu-Thach

.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ricardo Manuel | last post by:
Hi, I'm using a Datagrid that I fill with a Dataset but when I configure the paging with the Navigation Buttons I can't put them working, I've tried both methods (Next, Previous and Page Numbers)...
0
by: Stephen | last post by:
This is a real brain-teaser and i'd really appreciate it if someone can try and understand what im trying to do and give me a few pointers or ideas to help me work out my problem. Im basically...
3
by: Joseph D. DeJohn | last post by:
I am trying to get pagination working on a datagrid. Can anyone point me to a resource for help on this? I'm not sure if custom paging is the best option or not.
1
by: Maziar Aflatoun | last post by:
Hi, I have a Datagrid with AllowPaing property set so that the two arrows for the next and previous set of rows are showing. This is working fine. Now is there a way to instead of the 2...
5
by: Patrick.O.Ige | last post by:
Hi Guys, I have a datagrid wit editing and updating. But after adding Paging IT WON'T PAGE!! It compiles well but when i click on the paging link it doesn't go to the next link.. When i remove...
6
by: Shawn | last post by:
Hi. I already have a datagrid where I'm using paging. I have a stored procedure that fills a temp table with 200-500 rows and then sends back 10 records at the time. When I go to page 2 the SP...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
6
by: coleenholley | last post by:
Hi All :-) I need to populate a table I created as a web form. Are there any links to show me how to do this? I CANNOT use a dtagrid for this, the table has to be laid out as follows: Header...
0
by: ashish.dwivedi1 | last post by:
Hi, I am building a ASP .NET composite control containing a datagrid during which I am finding a problem while paging of the grid. The problem is for example if I am having three pages to be...
2
by: getziiiiiiiiiii | last post by:
Hi There. . I need some help in paging (which is not working) in ASP:DATAGRID My Data source id is a function which returns DataTable to this datagrid. Do i need a code behind to get the next...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.