troosters
asked on
asp.net moving to next record
I have found some code on the net and altered it a bit, but it onl works one time.
I need to 'scroll' through my records. But I can only go one time to the next record, what is wrong ?
code.txt
I need to 'scroll' through my records. But I can only go one time to the next record, what is wrong ?
code.txt
You keep on going to row 1 in your code (because you set it to 0 in the first line).
I'm not sure if keeping your datatable in a session is the best solution, why do you do that?
But if you also put your rowindex in a session variable, in the page_load where you also put your datatable in the session and then everytime when the btnNext is clicked you do the rowindex++ (and not the int rowindex = 0), you will get the next line.
I'm not sure if keeping your datatable in a session is the best solution, why do you do that?
But if you also put your rowindex in a session variable, in the page_load where you also put your datatable in the session and then everytime when the btnNext is clicked you do the rowindex++ (and not the int rowindex = 0), you will get the next line.
ASKER
BuggyCoder, I use int rowIndex = 1; at the beginning otherwise it just shows the first one twice. Also it goes on after the last record and then errors, so I changed if (rowIndex < dt.Rows.Count) in stead of <=
ingriT, I just found this code on the internet.
Is there a better way of doing it ? Now I just show one textbox, but it is going to be like 15 textboxes when it's finished.
ingriT, I just found this code on the internet.
Is there a better way of doing it ? Now I just show one textbox, but it is going to be like 15 textboxes when it's finished.
What are you trying to achieve with your page? Are you showing a recordset, with a button to go to the next record? I would use a ListView for that, with a DataPager and a SqlDataSource, or a GridView with AllowPaging="true" and a SqlDataSource.
See these pages for an example:
http://www.4guysfromrolla.com/articles/021308-1.aspx
http://www.codeproject.com/Articles/16238/GridView-Custom-Paging
See these pages for an example:
http://www.4guysfromrolla.com/articles/021308-1.aspx
http://www.codeproject.com/Articles/16238/GridView-Custom-Paging
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Do you also use that if you just want to show one record at a time. The record will contain lot's of info like name, firstname, address, language, work , job, weekend, car, driving licence, studies, hobbies, info, work experience, age, born, married, children, gender, nationality, ...
I thought to have a good overview it would be better to use something to fill textboxes which I can place wherever I want ?
I thought to have a good overview it would be better to use something to fill textboxes which I can place wherever I want ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
Basically need to store rowindex in session so that its state persists during postbacks...