473,386 Members | 1,791 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,386 software developers and data experts.

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 18 '05 #1
2 2499
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 18 '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 18 '05 #3

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

Similar topics

2
by: Islam Elkhayat | last post by:
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...
5
by: ad | last post by:
I have a datetime filed, name Birthday. I use aTexBox.Text= ((DateTime)dr).ToShortDateString(); but it result in an .InvalidCastException: How can I datetime field in a TextBox?
0
by: Seiche V via DotNetMonster.com | last post by:
hy. i want to fill a data table from a dataset using SqlDataAdapter.fill(myTable), but i get the error: System.NullReferenceException: Object reference not set to an instance of an object. ...
5
by: Helixpoint | last post by:
Here is my code: Dim availMach As New ASPNETProduct.machinedb() Dim dstMachList As DataSet dstMachList = availMach.GetAvailMach(theSearchVal, theSearchBy, theMachCode1, theSearchView,...
1
by: Jorge Maganto | last post by:
Hi! I'm building a site in ASP.NET which makes a query that return 50.000 results, this result is read by a DataAdapter to a DataSet (myDataAdter.Fill(myDataSet)). The problem is if the query is...
5
by: .Net Sports | last post by:
I have an open datareader that gets data from an sql statement, but when I try to put it into a dataset so that my datagrid can pick it up, I get a 'System.Data.SqlClient.SqlDataReader' does not...
2
by: Stanav | last post by:
Hello all, I'm developing a web application using VB.Net 2003 and Framework 1.1. This application queries an AS/400 database. I'm using the IBM OleDb provider that came with IBM Client Access for...
0
by: Jason Huang | last post by:
Hi, In my C# Windows Form MyForm, it has a ListView ListView1. How do I fill the data from a DataReader into ListView1 if the DataReader if the DataReader has 3 rows and 5 columns? Thanks for...
0
by: mike1402 | last post by:
Hi ! I get the error below sometimes when retrieving a big amount of data using Datadapter.Fill(dataset,"table"). But when I send the command Fill again, there is no error. Is it a fault of...
2
by: Ryan Liu | last post by:
Hi, If I have a very big view in database, it covers 15 tables, each table has 1000 columns. When I issue select * from view, the database will give error -- too many columns. Can I use a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.