Fill TextBox with DataReader...

Discussion in 'ASP .Net' started by Islam Elkhayat, Nov 22, 2004.

  1. 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
     
    Islam Elkhayat, Nov 22, 2004
    #1
    1. Advertising

  2. Islam Elkhayat

    Jay Guest

    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" <> wrote in message
    news:...
    > 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
    >
     
    Jay, Nov 22, 2004
    #2
    1. Advertising

  3. Islam Elkhayat

    Saravana Guest

    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" <> wrote in message
    news:...
    > 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
    >
    >
     
    Saravana, Nov 22, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kathy Burke
    Replies:
    1
    Views:
    1,128
    Severin
    Nov 10, 2003
  2. Peppie
    Replies:
    0
    Views:
    809
    Peppie
    Jun 1, 2005
  3. .Net Sports

    Cannot use "fill" with Datareader

    .Net Sports, Aug 26, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    802
    John Horst
    Aug 29, 2005
  4. Replies:
    1
    Views:
    575
    Jacek Stawicki
    Jul 23, 2006
  5. E-Coder
    Replies:
    1
    Views:
    173
    E-Coder
    Jul 2, 2003
Loading...

Share This Page