Web DataGrid

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

    #1

    Web DataGrid

    Hi all,

    First, let me tell you I am confused by the different choices of
    newsgroups. I see no newsgroups that deal with webapps and
    winapps differently, but I see them as two very different things
    even if the language is vb.net.

    Anyway, I have a Web App DataGrid question. It should be simple.

    Drop a datagrid on a web form, set datasource, call databind, it works.
    Set AllowPaging, set up the page change event as follows:
    dgPolicies.Curr entPageIndex = e.NewPageIndex

    dgPolicies.Data Bind()

    When I click on a 'page' link my code is run but I see NOTHING!

    How can I get the control to re-display itself with the next page data????

    TIA

    kpg





  • CodeMeister

    #2
    Re: Web DataGrid


    "kpg" <ipost@therefor eiam.com> wrote in message
    news:ul9XC8FcFH A.3808@TK2MSFTN GP14.phx.gbl...[color=blue]
    > Hi all,
    >
    > First, let me tell you I am confused by the different choices of
    > newsgroups. I see no newsgroups that deal with webapps and
    > winapps differently, but I see them as two very different things
    > even if the language is vb.net.
    >
    > Anyway, I have a Web App DataGrid question. It should be simple.
    >
    > Drop a datagrid on a web form, set datasource, call databind, it works.
    > Set AllowPaging, set up the page change event as follows:
    > dgPolicies.Curr entPageIndex = e.NewPageIndex
    >[/color]

    You need to get the data to bind to in your code. Calling DataBind without
    specifying the DataSource property results in an empty grid.

    dgPolicies.Data Source = myDataSource;
    [color=blue]
    > dgPolicies.Data Bind()
    >
    > When I click on a 'page' link my code is run but I see NOTHING!
    >
    > How can I get the control to re-display itself with the next page data????
    >
    > TIA
    >
    > kpg
    >
    >
    >
    >
    >[/color]


    Comment

    • kpg

      #3
      Re: Web DataGrid

      "CodeMeiste r" <jwojtowicz@cod emeister.net> wrote in message
      news:eF4MM1GcFH A.3932@TK2MSFTN GP12.phx.gbl...
      [color=blue]
      > You need to get the data to bind to in your code. Calling DataBind without
      > specifying the DataSource property results in an empty grid.[/color]

      No, sorry, that does not work.

      I set the datasource in the page load event and the grid displays just
      fine. Even if I reset the datasource in the page change event I still
      get a blank page after I click one of the navigation buttons.

      Now I don't re-query the datatable that I use as a datasource, I just
      re-assign the one I queried in the page load event.

      Do I have to requery the database again? That does not seem right.
      If I were going to do that I would just through away the grid and do
      it myself.

      Below is my code. I added the session variable just to test the need
      to re-set the data source.

      <page load>
      'code to load dtDataDtable
      Session("MyTabl e") = dtDataTable
      dgPolicies.Data Source = dtDataTable
      dgPolicies.Data Bind()
      <\page load>

      <page change>
      dgPolicies.Data Source = Session("MyTabl e")
      dgPolicies.Curr entPageIndex = e.NewPageIndex
      dgPolicies.Data Bind()
      <\page change>

      the above code results in a blank page after navigating to the
      next page of the data grid (it has 23 pages).

      ???
      kpg

      Comment

      • kpg

        #4
        Re: Web DataGrid

        Nervermind...

        After playing around with the sorting I had created a new
        session variable to hold the DataView and when I set that
        in the Page change event it does work. I reverted to the
        datatable and it also works...

        thanks.


        Comment

        Working...