470,596 Members | 1,503 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,596 developers. It's quick & easy.

Fill TextBox with DataReader...

In my C# Web Application
I need to fill a textbox with DataReader and use a Next Button to view next
value...
I created the Datareader in the Page_Load but everytime it get result of the
First row.
If i use a While or For loop i get result of the last row...
How can i check "PostBack" to do so our if there is another way to fill the
textbox and use the Next button to see next result rather than DataReader??
thanx
Nov 16 '05 #1
2 6379
Jay
you can keep track of the current record number in a variable and store it
either in the view state of the page / Session / Hiden control.
and skip that many records the next time the button_click event is caled.

instead if you don't 've much data returned from the database call , then
you can fill the datatable / dataset and store this in Session also store
the current datarow being displayed and on the next button_click , skip that
many rows. this methood will eliminate multiple database calls everytime the
button_click event is called.
Will this do ?

Jay

"Islam Elkhayat" <is******@yahoo.com> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl...
In my C# Web Application
I need to fill a textbox with DataReader and use a Next Button to view
next value...
I created the Datareader in the Page_Load but everytime it get result of
the First row.
If i use a While or For loop i get result of the last row...
How can i check "PostBack" to do so our if there is another way to fill
the textbox and use the Next button to see next result rather than
DataReader??
thanx

Nov 16 '05 #2
Instead of using datareader, you can use dataset. During page_load you can
load the dataset and you can store it in session. When post back occurs you
can find the current record id from hidden field or viewstate and then you
can populate the next record in textbox.

--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Islam Elkhayat" <is******@yahoo.com> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl...
In my C# Web Application
I need to fill a textbox with DataReader and use a Next Button to view next value...
I created the Datareader in the Page_Load but everytime it get result of the First row.
If i use a While or For loop i get result of the last row...
How can i check "PostBack" to do so our if there is another way to fill the textbox and use the Next button to see next result rather than DataReader?? thanx

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Seiche V via DotNetMonster.com | last post: by
5 posts views Thread by Helixpoint | last post: by
1 post views Thread by Jorge Maganto | last post: by
2 posts views Thread by Islam Elkhayat | last post: by
5 posts views Thread by .Net Sports | last post: by
reply views Thread by Jason Huang | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.