Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1147
optimise way to ajax with Ultragrid
posted

This is the grid mark up we mostly use 


<igtbl:UltraWebGrid ID="InfraGrid_Di" runat="server" Browser="Xml" EnableAppStyling="True" Width="100%" StyleSetName="Office2007Black"
OnInitializeDataSource="Load_Through_Ajax" > 
        ....
 ....
 ....
</igtbl:UltraWebGrid>

and in the code behind we write

    protected void Load_Through_Ajax(object sender, UltraGridEventArgs e)
    {
          WorkBind();         
    }


and in the WorkBind() function we write some query to fetch data to dataset and then assing to grid.

so in this case did we  really use a optimise way to code.
 As I find every postback page is fetching data from the server.


protected void Load_Through_Ajax(object sender, UltraGridEventArgs e)
    {
        if(!IspostBack())
          WorkBind();         
    }

if I write this code with Ispostback then fetches first page paged data well, shown above.
but when I click on the 2nd page on grid paged data it shows empty grid.

Thanks, suggest proper method.

Parents
No Data
Reply
  • 12025
    posted

    Hello,

    Because your data could be huge, the grid does not want to take the responsibility of holding on to the data, but relies on the InitializeDatasource to get the data any time a grid operation is performed, that requires it to look at all the data again. To give you a solution, you have two options.

    One option is you store the data within a session yourself and use session to supply data to the grid, this way you don't have to query your back store every time. There is a draw back though, your data will have to live in the session at all times and also if you have a web farm senario that is serving up your application, this solution may not work.

    Another option is to see if the WebDataGrid can work for you. It has a  property called EnabeDataViewState that might help you for your requirement. If you enable this property then the grid will store the data within the view state and you don't have to query your database everytime there is a postback/ajax call.

    Hope this helps.

    Taz.

Children
No Data