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. General Programming
  3. C#
  4. paging dataGrid events

paging dataGrid events

Scheduled Pinned Locked Moved C#
helpquestion
5 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.
  • S Offline
    S Offline
    sharon
    wrote on last edited by
    #1

    hello you all, I have a problem: I have a dataGrid with two events: 1. public void DataGrid1_ChooseLine(object sender, DataGridCommandEventArgs e) { try{ complaintId = Convert.ToInt32(e.Item.Cells[6].Text); } catch(Exception e) { } } and: 2. public void changePage(Object sender, DataGridPageChangedEventArgs e) { DataGrid1.CurrentPageIndex = e.NewPageIndex; DataGrid1.DataSource = dataSet; DataGrid1.DataBind(); } each of them works wonderful alone, but when I use them both I get this exception: "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values..." what can be the problem and how can I change it to work? thank you very much for your help, sharon.

    S R 2 Replies Last reply
    0
    • S sharon

      hello you all, I have a problem: I have a dataGrid with two events: 1. public void DataGrid1_ChooseLine(object sender, DataGridCommandEventArgs e) { try{ complaintId = Convert.ToInt32(e.Item.Cells[6].Text); } catch(Exception e) { } } and: 2. public void changePage(Object sender, DataGridPageChangedEventArgs e) { DataGrid1.CurrentPageIndex = e.NewPageIndex; DataGrid1.DataSource = dataSet; DataGrid1.DataBind(); } each of them works wonderful alone, but when I use them both I get this exception: "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values..." what can be the problem and how can I change it to work? thank you very much for your help, sharon.

      S Offline
      S Offline
      sharon
      wrote on last edited by
      #2

      after some debugging I noticed that when I change page it goes to the ChooseLine event and than go to the pageChang event (very weird):confused: maybe someone knowes why?

      1 Reply Last reply
      0
      • S sharon

        hello you all, I have a problem: I have a dataGrid with two events: 1. public void DataGrid1_ChooseLine(object sender, DataGridCommandEventArgs e) { try{ complaintId = Convert.ToInt32(e.Item.Cells[6].Text); } catch(Exception e) { } } and: 2. public void changePage(Object sender, DataGridPageChangedEventArgs e) { DataGrid1.CurrentPageIndex = e.NewPageIndex; DataGrid1.DataSource = dataSet; DataGrid1.DataBind(); } each of them works wonderful alone, but when I use them both I get this exception: "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values..." what can be the problem and how can I change it to work? thank you very much for your help, sharon.

        R Offline
        R Offline
        Rupel
        wrote on last edited by
        #3

        usually the debugger tells you, in which line exactly the exception was thrown. which line is it? :wq

        S 1 Reply Last reply
        0
        • R Rupel

          usually the debugger tells you, in which line exactly the exception was thrown. which line is it? :wq

          S Offline
          S Offline
          sharon
          wrote on last edited by
          #4

          the line that debugger tells me is: complaintId = Convert.ToInt32(e.Item.Cells[6].Text); in chooseLine event i.e. he goes to the wrong event. why???

          R 1 Reply Last reply
          0
          • S sharon

            the line that debugger tells me is: complaintId = Convert.ToInt32(e.Item.Cells[6].Text); in chooseLine event i.e. he goes to the wrong event. why???

            R Offline
            R Offline
            Rupel
            wrote on last edited by
            #5

            well, the cell-array doesn't seem to have 7 elements - thus cell[6] rises the Out-Of-Range-Exception. :wq

            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