Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I've written a couple of windows based database apps now which would usually use this code to navigate to the next record:

 

Me.BindingContext(DataSet1, "mailinglist").Position = (Me.BindingContext(DataSet1, "Mailinglist").Position + 1)

 

But in asp.net this isnt possible.

 

My feeble code currently exists of:

 

   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       SqlDataAdapter1.Fill(DataSet11)
       TextBox1.DataBind()


   End Sub

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

   End Sub

 

This has bound a textbox to the dataset.

 

How would i navigate to the next record in the dataset?

 

Nick

Posted

A DataSet is made of Tables (ds.Tables)

And a Table is made of Columns and Rows (.Rows .Columns)

 

You can index them with (x) where x is an integer or , in the case of Columns, the ColumnName.

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

Man ... i'm seriously stuck.

 

Could someone explain this to me.

 

I keep seeing references to datagrid's everywhere. But i'm not use if thats what i want.

 

I'm just trying to create a basic webform that will navigate records on the sql server.

 

So textbox1 would read record one on load. Then when you hit next Textbox1 displays record 2.

 

I cant find example coding anywhere for the next button :(

 

nick

  • Administrators
Posted (edited)

Web applications behave differently from Windows applications. A windows application will maintain state as long as the application is running and as such will persist the DataSet between button clicks.

Web applications however lose their state between postbacks (button clicks etc) and will require either the DataSet to be recreated on each page refresh or for it to be deliberately stored on the server (probably as a Session, Application or Cache variable, depending on your requirements).

To allow a simple Next button to work you would need to store the current position in the DataSet so it could be accessed across postbacks (probably using Session, ViewState or QueryString). This would need to be read each time the page is refreshed and the appropriate data retrieved and used to populate the page.

Edited by PlausiblyDamp

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Sorry for keep coming back and forth but i don't have a clue lol. I'm figuring it out as i go along.

 

How do i make the dataset goto the position that i have stored?

 

Say I wanted it to goto record 10.

 

Its not dataset11.tables(0).rows(10)

 

(lost)

 

Nick

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...