This is a migrated thread and some comments may be shown as answers.

ClientEvents OnCommand="RaiseCommand" causes grid to automatically load

1 Answer 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 16 Mar 2009, 03:21 PM

 

 

I have a page that has three radgrids on it.  When I first come into a page I have two dropowns and a textbox that collect data from the user and a button that executes a search.  I do not want any of the grids to load until I have clicked the execute button and then I want one of the grids to load.  Everything works fine, but when I add 

 

 

 

ClientEvents OnCommand="RaiseCommand"
to any of the grids client settings, the grid that this has been added to tries to load on page_load before I have collected any data or clicked the button, which causes an error becuase there is no data for the grid.

Is there a way to stop this automatic grid loading when using the clientevents oncommand.

Thank you.

Aaron

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Mar 2009, 05:30 AM
Hi,

A suggestion would be to set the grid to an empty string array in the NeedDataSource event when there is no data.

 protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        RadGrid1.DataSource = new string[] { };
    }
Tags
Grid
Asked by
Aaron
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or