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
  1. Home
  2. Web Development
  3. ASP.NET
  4. Gridview paging?

Gridview paging?

Scheduled Pinned Locked Moved ASP.NET
5 Posts 5 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.
  • K Offline
    K Offline
    Karthick_gc
    wrote on last edited by
    #1

    Hi friends, I use a grid view for paging I write the coding like this. form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" BorderWidth="2px" BackColor="White" GridLines="None" CellPadding="3" CellSpacing="1" BorderStyle="Ridge" BorderColor="White"> </asp:GridView> </div> </form> try { con.Open(); com=new SqlCommand("SELECT [ProductName], [UnitPrice],[UnitsInStock], [QuantityPerUnit] FROM [Products] order by [ProductName]",con); SqlDataAdapter da = new SqlDataAdapter(com); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); ds.Dispose(); da.Dispose(); con.Close(); } catch (Exception ex) { Response.Write(ex.Message); } The datas are displayed. But when i click on the 2nd number, it shows a error The GridView 'GridView1' fired event PageIndexChanging which wasn't handled Can anyone say where to handle this event?

    A A B V 4 Replies Last reply
    0
    • K Karthick_gc

      Hi friends, I use a grid view for paging I write the coding like this. form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" BorderWidth="2px" BackColor="White" GridLines="None" CellPadding="3" CellSpacing="1" BorderStyle="Ridge" BorderColor="White"> </asp:GridView> </div> </form> try { con.Open(); com=new SqlCommand("SELECT [ProductName], [UnitPrice],[UnitsInStock], [QuantityPerUnit] FROM [Products] order by [ProductName]",con); SqlDataAdapter da = new SqlDataAdapter(com); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); ds.Dispose(); da.Dispose(); con.Close(); } catch (Exception ex) { Response.Write(ex.Message); } The datas are displayed. But when i click on the 2nd number, it shows a error The GridView 'GridView1' fired event PageIndexChanging which wasn't handled Can anyone say where to handle this event?

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Just do it ;)

      protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
      {
      GridView1.PageIndex = e.NewPageIndex;
      GridView1.DataBind();
      }

      cheers, Abhijit CodeProject MVP

      1 Reply Last reply
      0
      • K Karthick_gc

        Hi friends, I use a grid view for paging I write the coding like this. form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" BorderWidth="2px" BackColor="White" GridLines="None" CellPadding="3" CellSpacing="1" BorderStyle="Ridge" BorderColor="White"> </asp:GridView> </div> </form> try { con.Open(); com=new SqlCommand("SELECT [ProductName], [UnitPrice],[UnitsInStock], [QuantityPerUnit] FROM [Products] order by [ProductName]",con); SqlDataAdapter da = new SqlDataAdapter(com); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); ds.Dispose(); da.Dispose(); con.Close(); } catch (Exception ex) { Response.Write(ex.Message); } The datas are displayed. But when i click on the 2nd number, it shows a error The GridView 'GridView1' fired event PageIndexChanging which wasn't handled Can anyone say where to handle this event?

        A Offline
        A Offline
        anilpal
        wrote on last edited by
        #3

        Hi, U need to implement "PageIndexChanging" event of GridView. like: GridView1.PageIndex =e.NewPageIndex

        Regards Anil Pal

        1 Reply Last reply
        0
        • K Karthick_gc

          Hi friends, I use a grid view for paging I write the coding like this. form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" BorderWidth="2px" BackColor="White" GridLines="None" CellPadding="3" CellSpacing="1" BorderStyle="Ridge" BorderColor="White"> </asp:GridView> </div> </form> try { con.Open(); com=new SqlCommand("SELECT [ProductName], [UnitPrice],[UnitsInStock], [QuantityPerUnit] FROM [Products] order by [ProductName]",con); SqlDataAdapter da = new SqlDataAdapter(com); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); ds.Dispose(); da.Dispose(); con.Close(); } catch (Exception ex) { Response.Write(ex.Message); } The datas are displayed. But when i click on the 2nd number, it shows a error The GridView 'GridView1' fired event PageIndexChanging which wasn't handled Can anyone say where to handle this event?

          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          Can you search on google?![^]


          I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

          1 Reply Last reply
          0
          • K Karthick_gc

            Hi friends, I use a grid view for paging I write the coding like this. form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" BorderWidth="2px" BackColor="White" GridLines="None" CellPadding="3" CellSpacing="1" BorderStyle="Ridge" BorderColor="White"> </asp:GridView> </div> </form> try { con.Open(); com=new SqlCommand("SELECT [ProductName], [UnitPrice],[UnitsInStock], [QuantityPerUnit] FROM [Products] order by [ProductName]",con); SqlDataAdapter da = new SqlDataAdapter(com); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); ds.Dispose(); da.Dispose(); con.Close(); } catch (Exception ex) { Response.Write(ex.Message); } The datas are displayed. But when i click on the 2nd number, it shows a error The GridView 'GridView1' fired event PageIndexChanging which wasn't handled Can anyone say where to handle this event?

            V Offline
            V Offline
            Vimalsoft Pty Ltd
            wrote on last edited by
            #5

            see this Paging without a wizard (SqldataSource control) [^][^] Hope it Helps

            Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za www.ITS.co.za

            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