quickstart db sample?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • LL

    #1

    quickstart db sample?

    Hi,

    I'm trying datagrid9.aspx sample:Updating a Row of Data w/ Validation.

    But after I set the paging property, when I click the page number, it won't
    go to the next page. Any ideas?

    Thanks...


  • Ravikanth[MVP]

    #2
    quickstart db sample?

    Hi

    Did you set the newpageindex to currentpageinde x in
    datagrid paging event


    Try this:
    Private Sub PageGrid(ByVal source As Object, ByVal e As
    DataGridPageCha ngedEventArgs)
    MyDataGrid.Curr entPageIndex = e.NewPageIndex
    BindGrid()
    End Sub


    HTH
    Ravikanth[MVP]

    [color=blue]
    >-----Original Message-----
    >Hi,
    >
    >I'm trying datagrid9.aspx sample:Updating a Row of Data[/color]
    w/ Validation.[color=blue]
    >
    >But after I set the paging property, when I click the[/color]
    page number, it won't[color=blue]
    >go to the next page. Any ideas?
    >
    >Thanks...
    >
    >
    >.
    >[/color]

    Comment

    • LL

      #3
      Re: quickstart db sample?

      Thanks Ravikanth.

      But the second page is empty?

      I'm running datagrid9.aspx.

      private void MyDataGrid_Page IndexChanged(ob ject source,
      System.Web.UI.W ebControls.Data GridPageChanged EventArgs e)

      {

      // Set CurrentPageInde x to the page the user clicked.

      MyDataGrid.Curr entPageIndex = e.NewPageIndex;

      MyDataGrid.Data Bind();

      }

      "Ravikanth[MVP]" <dvravikanth@ho tmail.com> wrote in message
      news:0c6101c398 b1$19a430d0$a60 1280a@phx.gbl.. .[color=blue]
      > Hi
      >
      > Did you set the newpageindex to currentpageinde x in
      > datagrid paging event
      >
      >
      > Try this:
      > Private Sub PageGrid(ByVal source As Object, ByVal e As
      > DataGridPageCha ngedEventArgs)
      > MyDataGrid.Curr entPageIndex = e.NewPageIndex
      > BindGrid()
      > End Sub
      >
      >
      > HTH
      > Ravikanth[MVP]
      >
      >[color=green]
      > >-----Original Message-----
      > >Hi,
      > >
      > >I'm trying datagrid9.aspx sample:Updating a Row of Data[/color]
      > w/ Validation.[color=green]
      > >
      > >But after I set the paging property, when I click the[/color]
      > page number, it won't[color=green]
      > >go to the next page. Any ideas?
      > >
      > >Thanks...
      > >
      > >
      > >.
      > >[/color][/color]


      Comment

      • LL

        #4
        Re: quickstart db sample?

        Another question:

        How to enable "sort" function in the datagrid9.aspx sample?
        Thanks for the help!


        "Ravikanth[MVP]" <dvravikanth@ho tmail.com> wrote in message
        news:0c6101c398 b1$19a430d0$a60 1280a@phx.gbl.. .[color=blue]
        > Hi
        >
        > Did you set the newpageindex to currentpageinde x in
        > datagrid paging event
        >
        >
        > Try this:
        > Private Sub PageGrid(ByVal source As Object, ByVal e As
        > DataGridPageCha ngedEventArgs)
        > MyDataGrid.Curr entPageIndex = e.NewPageIndex
        > BindGrid()
        > End Sub
        >
        >
        > HTH
        > Ravikanth[MVP]
        >
        >[color=green]
        > >-----Original Message-----
        > >Hi,
        > >
        > >I'm trying datagrid9.aspx sample:Updating a Row of Data[/color]
        > w/ Validation.[color=green]
        > >
        > >But after I set the paging property, when I click the[/color]
        > page number, it won't[color=green]
        > >go to the next page. Any ideas?
        > >
        > >Thanks...
        > >
        > >
        > >.
        > >[/color][/color]


        Comment

        • LL

          #5
          More Info.

          Actually I got this error when I enable "sorting" property and click Update:

          Exception Details: System.Argument OutOfRangeExcep tion: Index was out of
          range. Must be non-negative and less than the size of the collection.
          Parameter name: index

          Source Error:

          Line 97: myCommand.Param eters.Add(new SqlParameter("@ Contract",
          SqlDbType.NVarC har,1));
          Line 98:
          Line 99: myCommand.Param eters["@Id"].Value =
          MyDataGrid.Data Keys[(int)E.Item.Ite mIndex];
          Line 100:
          Line 101: String[] cols =
          {"LName","FName ","Phone","Addr ess","City","Zi p"};

          Source File: c:\project\auto sales\datagrid9 .aspx.cs Line: 99



          myCommand.Param eters["@Id"].Value =
          MyDataGrid.Data Keys[(int)E.Item.Ite mIndex];

          How to fix it?


          Comment

          • Jon Skeet [C# MVP]

            #6
            Re: More Info.

            LL <lionelluo@hotm ail.com> wrote:[color=blue]
            > Actually I got this error when I enable "sorting" property and click Update:
            >
            > Exception Details: System.Argument OutOfRangeExcep tion: Index was out of
            > range. Must be non-negative and less than the size of the collection.
            > Parameter name: index
            >
            > Source Error:
            >
            > Line 97: myCommand.Param eters.Add(new SqlParameter("@ Contract",
            > SqlDbType.NVarC har,1));
            > Line 98:
            > Line 99: myCommand.Param eters["@Id"].Value =
            > MyDataGrid.Data Keys[(int)E.Item.Ite mIndex];
            > Line 100:
            > Line 101: String[] cols =
            > {"LName","FName ","Phone","Addr ess","City","Zi p"};
            >
            > Source File: c:\project\auto sales\datagrid9 .aspx.cs Line: 99
            >
            > myCommand.Param eters["@Id"].Value =
            > MyDataGrid.Data Keys[(int)E.Item.Ite mIndex];
            >
            > How to fix it?[/color]

            Well the first thing to do is find out what E.Item.ItemInde x is, I'd
            think...

            --
            Jon Skeet - <skeet@pobox.co m>
            Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

            If replying to the group, please do not mail me too

            Comment

            Working...