Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Gridview and Paging

Gridview and Paging

Scheduled Pinned Locked Moved ASP.NET
helptutorial
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alwinSCH
    wrote on last edited by
    #1

    Hello, Please can somebody help me! On my page I have a radiobuttonlist with 2options 1option name 2option User When I click option1 a textbox becomes visible, enter any text in here and a dataset will be filled with information and bound to gridview to display (textbox textchanged event) (so far so good) then when i press option2 the gridview stays visible, a dropdownlist becomes visible where i can choose a user,a new dataset is filled and bound to the gridview (function selectedindexchanged event) (so far so good) in the gridview allowpaging=true pagesize =10 now when i press a button (next, previous)the paging does not work I still see page 1. Please can you give me an idea how to solve this! Thanks, Alwin

    A I 2 Replies Last reply
    0
    • A alwinSCH

      Hello, Please can somebody help me! On my page I have a radiobuttonlist with 2options 1option name 2option User When I click option1 a textbox becomes visible, enter any text in here and a dataset will be filled with information and bound to gridview to display (textbox textchanged event) (so far so good) then when i press option2 the gridview stays visible, a dropdownlist becomes visible where i can choose a user,a new dataset is filled and bound to the gridview (function selectedindexchanged event) (so far so good) in the gridview allowpaging=true pagesize =10 now when i press a button (next, previous)the paging does not work I still see page 1. Please can you give me an idea how to solve this! Thanks, Alwin

      A Offline
      A Offline
      alwinSCH
      wrote on last edited by
      #2

      Maybe I little code could help! This i what i call on dropdownlist1.selectedindexchanged Protected Sub change_dropdownlist() Dim ds As New DataSet Dim cmdopvolging As New SqlCommand("SP_Gridresult", objconnection) cmdopvolging.CommandType = CommandType.StoredProcedure Dim parbeh As New SqlParameter("@beh", SqlDbType.Int) Dim parsessie As New SqlParameter("@sessie", SqlDbType.Char, 50) parbeh.Direction = ParameterDirection.Input If dropdownlist1.SelectedItem.Text = "[ALL]" Then parbeh.Value = 0 Else parbeh.Value = CInt(dropdownlist.SelectedValue) End If parsessie.Direction = ParameterDirection.Input parsessie.Value = CStr(Session.SessionID) cmdopvolging.Parameters.Add(parbeh) cmdopvolging.Parameters.Add(parsessie) Dim aantal As Integer objconnection.Open() aantal = cmdopvolging.ExecuteNonQuery objconnection.Close() 'Show temporary table in gridview Dim voorw1 As String = " select streefdatum,naam,polisnr,code from t_leven_selectie" Dim daresult As New SqlDataAdapter(voorw1, objconnection) daresult.Fill(ds, "T_leven_selectie") 'Here comes the gridview GrdResult.DataSource = ds GrdResult.DataMember = "T_leven_selectie" GrdResult.DataBind() 'empty the table T_leven_selectie (temporary table) Dim cmddel As New SqlCommand("SP_deltempSelectie", objconnection) cmddel.CommandType = CommandType.StoredProcedure Dim parsessiedel As New SqlParameter("@sessie", SqlDbType.Char, 50) parsessiedel.Direction = ParameterDirection.Input parsessiedel.Value = CStr(Session.SessionID) cmddel.Parameters.Add(parsessiedel) objconnection.Open() aantal = cmddel.ExecuteNonQuery objconnection.Close() And now i want to be able todo paging! But it does not work Alwin

      1 Reply Last reply
      0
      • A alwinSCH

        Hello, Please can somebody help me! On my page I have a radiobuttonlist with 2options 1option name 2option User When I click option1 a textbox becomes visible, enter any text in here and a dataset will be filled with information and bound to gridview to display (textbox textchanged event) (so far so good) then when i press option2 the gridview stays visible, a dropdownlist becomes visible where i can choose a user,a new dataset is filled and bound to the gridview (function selectedindexchanged event) (so far so good) in the gridview allowpaging=true pagesize =10 now when i press a button (next, previous)the paging does not work I still see page 1. Please can you give me an idea how to solve this! Thanks, Alwin

        I Offline
        I Offline
        Ista
        wrote on last edited by
        #3

        your not sync the PageIndexChange event and you not set the current page upon pastback if( IsPostBack ) { ... do code here } I'm not an expert yet, but I play one at work. Yeah and here too.

        A 1 Reply Last reply
        0
        • I Ista

          your not sync the PageIndexChange event and you not set the current page upon pastback if( IsPostBack ) { ... do code here } I'm not an expert yet, but I play one at work. Yeah and here too.

          A Offline
          A Offline
          alwinSCH
          wrote on last edited by
          #4

          In the page load event, i do if ispostback =false then ... 'Fill dropdownlist1 endif That is all i do in here why do i have to use these 2 functions PageIndexChanged --> used after the paging PageIndexChanging --> used before paging I have created them but there is no code in it So i don't know what you mean with PageIndexChange event? Thanks Alwin

          I 1 Reply Last reply
          0
          • A alwinSCH

            In the page load event, i do if ispostback =false then ... 'Fill dropdownlist1 endif That is all i do in here why do i have to use these 2 functions PageIndexChanged --> used after the paging PageIndexChanging --> used before paging I have created them but there is no code in it So i don't know what you mean with PageIndexChange event? Thanks Alwin

            I Offline
            I Offline
            Ista
            wrote on last edited by
            #5

            Well I saw grid and with the datagrid you need to record the current page it is on and each postback set the index page inside the grid the grid doesn't maintain state, you have too If we're on the same page, so to speak Nick I'm not an expert yet, but I play one at work. Yeah and here too.

            A 1 Reply Last reply
            0
            • I Ista

              Well I saw grid and with the datagrid you need to record the current page it is on and each postback set the index page inside the grid the grid doesn't maintain state, you have too If we're on the same page, so to speak Nick I'm not an expert yet, but I play one at work. Yeah and here too.

              A Offline
              A Offline
              alwinSCH
              wrote on last edited by
              #6

              I know if i do it with a datagrid it will work, (done something on an earlier project) But know using VS2005 --> a draw a gridview, because didn't see the datagrid, and here it will not work! Thanks i will solve it with a datagrid like earlier! Alwin

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups