•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 427,939 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,827 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 537 | Replies: 1
![]() |
•
•
Join Date: Jun 2008
Posts: 25
Reputation:
Rep Power: 1
Solved Threads: 0
Hei,
Im using ASP.NET as Front end and SQL Server as Backend. the codings are..
After inherits...... some connectin codingd are there
after the connection codings in Next button the following codings im writing....
Like wise im writing for PREVIOUS BUTTON also, only change is [ rec_count = rec_count - 1 ] By writing this,,, when the first time i click in the Next button , it goes to next record, but when next time i click in Next button ... it doesnt change.
then if i click in PREVIOUS button... It shows error like... "There is no record in position -1".
So many times i asked about this? but im not getting the correct solution. So any one Please get me correct soution??
Im using ASP.NET as Front end and SQL Server as Backend. the codings are..
asp.net Syntax (Toggle Plain Text)
imports system imports system.data imports system.data.sqlclient
After inherits...... some connectin codingd are there
asp.net Syntax (Toggle Plain Text)
dim con as SqlConnection dim adp as SqlDataAdapter dim com as SqlCommand dim data as Dataset
asp.net Syntax (Toggle Plain Text)
dim rec_count as integer = 0 dim row_count as integer = data.Tables(0).Rows.Count - 1 // so by this we will get total number of records. If rec_count <> row_count Then rec_count = rec_count + 1 TextBox1.Text = Data.Tables(0).Rows(rec_count).Item(0) TextBox2.Text = Data.Tables(0).Rows(rec_count).Item(1) Else MsgBox " This is the Last Record "
then if i click in PREVIOUS button... It shows error like... "There is no record in position -1".
So many times i asked about this? but im not getting the correct solution. So any one Please get me correct soution??
Last edited by peter_budo : Jul 9th, 2008 at 6:41 am. Reason: Correcting code tags, please use as follows [code]YOUR CODE HERE[/code]
Well when you click on the button, the page is posted back to the server and you start again with rec_count as 0.
Thus when you click on the Next button, you see only your first record and when you say previous (which is again a button click), it does 0-1= -1 and does not find any corresponding record at that position.
You need to know about State Management in order to get this code working for you. I suggest you store your table in a Session Variable and access it using individual datarows of a datatable.
PS- ASP.NET does not quite work the same way as VB.NET!
Thus when you click on the Next button, you see only your first record and when you say previous (which is again a button click), it does 0-1= -1 and does not find any corresponding record at that position.
You need to know about State Management in order to get this code working for you. I suggest you store your table in a Session Variable and access it using individual datarows of a datatable.
PS- ASP.NET does not quite work the same way as VB.NET!
Last edited by tuse : Jul 8th, 2008 at 7:56 am.
My blog on .NET- http://dotnet.tekyt.info
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Every time position value changed to '0'(First,Previous,Next,Last) (C#)
- ASP.NET Tutorial: Caching in ASP.NET (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: Avoid the Page_Load after clicking dropdownlist
- Next Thread: ? Website Admin Tool


Linear Mode