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

[Solved] Best Practice for loading an editable, ajax Grid for empty collection

0 Answers 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tom
Top achievements
Rank 1
Tom asked on 19 May 2011, 02:55 PM
I am loading an editable, ajax bound grid for a collection on an object.

Initially, this collection is empty and the grid is used to populate the data.
Since the grid is ajax bound and is empty, the grid attempts to reload the grid via ajax using the ajax Select client event (or if that is not specified, the location that the grid was loaded from), but can't get relevant parameters required since they are stored in data that would exist in the grid.

To prevent this, on first load of the view containing the grid, I use the following:

if(object.Collection.Count == 0)
{
    <p>Nothing in collection.</p>
    <a id="#addToCollectionId">Add to collection</a>
}
else
{
    //code to display Grid
}

I handle the behaviour to reload the grid on click of the anchor tag myself.

Is this best practice from Telerik?
Is there another recommended method for displaying an editable ajax grid for an empty collection?
Tags
Grid
Asked by
Tom
Top achievements
Rank 1
Share this question
or