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. Serial No

Serial No

Scheduled Pinned Locked Moved ASP.NET
design
7 Posts 4 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.
  • M Offline
    M Offline
    Mkanchha
    wrote on last edited by
    #1

    I am Trying to Display Serial No and Paging in datagrid. ----------------Bind Function------- Private Function Bindxx() dgxx.DataSource = objxx.Getxx() dgxx.DataBind() Private i As Integer = 0 Private Item As DataGridItem For Each Item In dgxx.items i += 1 Item.Cells(0).Text = i Next End Function ----------------------------------Paging---------- Private Sub dgxx_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dgStudents.PageIndexChanged dgStudents.CurrentPageIndex = e.NewPageIndex BindStudents() End Sub ------------------------------ If I set 5 rows Page size, For the First page It will display Perfect Serial No. Now When I click 2nd Page I will dispaly same serial No 1,2,3,4,5 but I want 6,7,8 etc. Mkanchha

    R M 2 Replies Last reply
    0
    • M Mkanchha

      I am Trying to Display Serial No and Paging in datagrid. ----------------Bind Function------- Private Function Bindxx() dgxx.DataSource = objxx.Getxx() dgxx.DataBind() Private i As Integer = 0 Private Item As DataGridItem For Each Item In dgxx.items i += 1 Item.Cells(0).Text = i Next End Function ----------------------------------Paging---------- Private Sub dgxx_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dgStudents.PageIndexChanged dgStudents.CurrentPageIndex = e.NewPageIndex BindStudents() End Sub ------------------------------ If I set 5 rows Page size, For the First page It will display Perfect Serial No. Now When I click 2nd Page I will dispaly same serial No 1,2,3,4,5 but I want 6,7,8 etc. Mkanchha

      R Offline
      R Offline
      rujuc
      wrote on last edited by
      #2

      Use this formula for the serial number column of the DataGrid (PageIndex * pagesize) + ItemIndex +1

      M 1 Reply Last reply
      0
      • R rujuc

        Use this formula for the serial number column of the DataGrid (PageIndex * pagesize) + ItemIndex +1

        M Offline
        M Offline
        Mkanchha
        wrote on last edited by
        #3

        THanks for Your Replay. But this formula where to write and How? Mkanchha

        M 1 Reply Last reply
        0
        • M Mkanchha

          THanks for Your Replay. But this formula where to write and How? Mkanchha

          M Offline
          M Offline
          Mkanchha
          wrote on last edited by
          #4

          I am using ASP.NET 1.1 Mkanchha

          1 Reply Last reply
          0
          • M Mkanchha

            I am Trying to Display Serial No and Paging in datagrid. ----------------Bind Function------- Private Function Bindxx() dgxx.DataSource = objxx.Getxx() dgxx.DataBind() Private i As Integer = 0 Private Item As DataGridItem For Each Item In dgxx.items i += 1 Item.Cells(0).Text = i Next End Function ----------------------------------Paging---------- Private Sub dgxx_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dgStudents.PageIndexChanged dgStudents.CurrentPageIndex = e.NewPageIndex BindStudents() End Sub ------------------------------ If I set 5 rows Page size, For the First page It will display Perfect Serial No. Now When I click 2nd Page I will dispaly same serial No 1,2,3,4,5 but I want 6,7,8 etc. Mkanchha

            M Offline
            M Offline
            meeram395
            wrote on last edited by
            #5

            Hi, There is an event for the datagrid called ItemDataBound. Suppose your datagrid name is dgrd1. Write the following code under that event. public void dgrd1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if(e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer) { e.Item.Cells[0].Text=Convert.ToString(e.Item.DataSetIndex + 1); } }

            Meeram395

            M R 2 Replies Last reply
            0
            • M meeram395

              Hi, There is an event for the datagrid called ItemDataBound. Suppose your datagrid name is dgrd1. Write the following code under that event. public void dgrd1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if(e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer) { e.Item.Cells[0].Text=Convert.ToString(e.Item.DataSetIndex + 1); } }

              Meeram395

              M Offline
              M Offline
              Mkanchha
              wrote on last edited by
              #6

              Thanks a Lots. It's worked Prefect. Mkanchha

              1 Reply Last reply
              0
              • M meeram395

                Hi, There is an event for the datagrid called ItemDataBound. Suppose your datagrid name is dgrd1. Write the following code under that event. public void dgrd1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if(e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer) { e.Item.Cells[0].Text=Convert.ToString(e.Item.DataSetIndex + 1); } }

                Meeram395

                R Offline
                R Offline
                rohit kakria
                wrote on last edited by
                #7

                Thank you...

                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