Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Record Navigation

Author  Topic 

vk18
Posting Yak Master

146 Posts

Posted - 2006-10-13 : 17:56:39

I have this code for the Record Navigation. It works fine but when i go to next page and come back then
i can't naviagate through records. any ideas..?
Thx

Private Sub cmdnext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdnext.Click

Dim objDS As DataSet = Session("DataSet")
Dim objDataRow As DataRow
If objDS.Tables(0).Rows.Count > Session("CurrentIndex") + 1 Then
Session("CurrentIndex") = Session("CurrentIndex") + 1
objDataRow = objDS.Tables(0).Rows(Session("CurrentIndex"))
Populatedata(objdatarow)
Else
MsgboxAlert("You have reached the last record.")
End If
End Sub



My Populate Data Code is


Public Sub populateData(ByVal objdatarow As DataRow)

If objdatarow("contracttype") Is DBNull.Value Then
contracttype = ""
Else
contracttype = objdatarow("Me.txtnumber.text")
End If

and so on........

End Sub



snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-10-14 : 16:33:03
quote:
when i go to next page and come back then
i can't naviagate through records.

What do you mean when you say "come back" - this isn't going to work very well if the user clicks the back button in their browser because the browser uses a cached copy of the page (displays the page without requesting it from the server) and therefore your CurrentIndex will be invalid. You'll need a previous button.

Also you should rather pass the index with each page so that when someone clicks any button on the page they make a new request with the index from the page. You can use the index on the server to find the following page - if you try to store the index on the server you'll have these sync problems.
Go to Top of Page

vk18
Posting Yak Master

146 Posts

Posted - 2006-10-16 : 16:29:22
Hi,

I am Not using the browser back button. I have a back button on the form that goes back to that page.
can you tell me how to pass the index..? an example will be good.
thx appreciate your help
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-10-17 : 07:12:30
save it in a hiden field and get it on the postback or in the session.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

vk18
Posting Yak Master

146 Posts

Posted - 2006-10-17 : 15:01:47
quote:
Originally posted by spirit1

save it in a hiden field and get it on the postback or in the session.

Hi,
what to save it in a hidden field..? can you explain me clearly..
Thx



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-10-18 : 04:14:07
save the index or what ever else in there.
or in the session.
or in the querystring.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

vk18
Posting Yak Master

146 Posts

Posted - 2006-11-01 : 13:32:41
quote:
Originally posted by spirit1

save the index or what ever else in there.
or in the session.
or in the querystring.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp

Go to Top of Page

vk18
Posting Yak Master

146 Posts

Posted - 2006-11-01 : 13:34:17
quote:
Originally posted by vk18

quote:
Originally posted by spirit1

save the index or what ever else in there.
or in the session.
or in the querystring.

Hi,
I am initializing the index = 0 on the page_load but still doesn't work

Session("currentindex") = 0
any ideas..?
Thx





Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp



Go to Top of Page
   

- Advertisement -