Data navigation help needed

A

Aaron

I am currently moving an old thick client solution to ASP.NET and I am
trying to replicate as much of the current UI as possible in an effort to
migrate users with a minimum of training.

On one particular form, there are DB navigate buttons which will allow for
BOF, MovePrevious, MoveNext , and EOF.

I am successfully populating a dataset with all of the required records.

I need to "bind" some textboxes to columns in the dataset. I am doing it
like this:

Dim Cell1 As String
Cell1 = DataSet.Tables(0).Rows(0).Item(1).ToString

txtFullname.Text = Trim(Cell1)

And so on for each textbox/column.
This works just fine for a one record dataset, but there are obviously
problems with this approach.

What is the best way to implement the BOF, MovePrevious, MoveNext , and EOF
buttons and allow for navigation of the dataset and populating the textboxes
with the correct row of data? Is a dataset the best object to use, or would
this work better with a datalist?

Any advice will be appreciated.

Thanks for your time,
Aaron
 
G

Guest

Do you want to bind or curse through records. If you truly want to go through
records, ala ASP, use a DataReader. This represents a forward only cursor.

If you want to bind, create your controls for each record in a control, like
a Repeater and allow it to "automagically" bind the different records for
you. Binding is pushing out and making the data stick, while cursing through
means you are in complete control (with the extra work needed). If you can
get the output you need without a custom model, I would aim for it; to do
this, you need to use the built in binding.

Hope this is making sense.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
A

Aaron

I'm sorry, this does not really clear things up for me. I need to be able
to have forward and backward navigation capabilities on the dataset.
Perhaps I'm not explaining things clearly enough.

I already have a dataset filled with all of the necessary records.
I am doing this on page load:

Sub PageLoad
Dim ApplicantActivityDS As DataSet
ApplicantActivityDS = GetApplicantActivity(Session("ApplicantID")) 'This
fills the dataset
FillApplicantScreen(ApplicantActivityDS)
End Sub

Sub FillApplicantScreen(ByVal ApplicantActivityDataset As DataSet)
txtActivityDate.Text =
ApplicantActivityDataset.Tables(0).Rows(0).Item(16).ToString
There are a lot more textboxes to fill from columns.
End Sub

What I would like to do is something like:
textbox1.text bound to Dataset column 1
textbox2.text bound to Dataset column 2
etc
then set the current dataset row to 0 (or determine the current row if it is
not 0)
then filltextboxes(CurrentRow)

When I click the movenext button, filltextboxes(CurrentRow + 1)
When I click the movelast button, filltextboxes(CurrentRow - 1)

I am not sure how to take all of my textboxes and bind them each to a
specific column in the dataset, as well as determine and control the row
that I am currently at.
There is a databind method for asp.net textboxes, but no datasource or
datamember.

Thanks for your help,
Aaron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top