Tuesday, 27 July 2010

Telerik RadGrid Frustration

RadGrid does not show or isn't visible on Page_Load?

Set a default value for your datasource SelectCommand of  the SqlDataSource of your Grid.

e.g.) <SelectParameters>

                <asp:ControlParameter Name="FleetNo" ControlID="txtFleetNo" PropertyName="Text" DefaultValue="0"/>
</SelectParameters>
 
I discovered this error, when using a MaintainFleet page and and an AddFleet page.
The maintain page was working perfectly with the RadGrid. So I copied the code over for my new Add page.
I changed my dropdown from the Maintain Page to a textbox on the Add page. That field is the control parameter of the Select statement . And unless you set a default value for the Textbox one, the grid will not be visible until a postback is done. Of course the code was working on the Maintain page.... the Dropdown had been set with a default value in the code.