RadGrid Add record bug/error

2 posts, 0 answers
  1. Shuja
    Shuja avatar
    7 posts
    Member since:
    Jan 2011

    Posted 19 Jan 2011 Link to this post

    Hi,

    I have a RadGrid with templated forms within it. I have the functionality to add, edit or delete a record in this grid.
    If i select the edit on a record,  i get a form listing under the record which lists the lists the UniqueData Key field in a label so you can identify the record you are editting. If i was to select the "add new record" button then i would get a blank form in the last record where the label would read "New Record". Also, if i had a record open for editting and then clicked on Add record, the editting would stop & only the add record form would be open.
    However, if i select "add record" first & then click on "edit for a different record, the edit record's edit form will display but the add record form will still be open. Also, both labels on the 2 open forms reads "new record" and you can't save the Edit record form (no error comes up but nothing happens when you click on save).
    Why does the grid allow the user to edit a record without closing the add record form? Why does it confuse the edit form for a new record form? Is this a bug in the RadGrid control & is there a way of stopping this? (i.e. if i click Add New Record then only the add record form should be visible  & if i then click edit a record the add record form should be cancelled and only the edit form should be visible).

    Please let me know if you have a solution to this.

    Regards,

    Shuja
  2. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 24 Jan 2011 Link to this post

    Hello Shuja,

    The edit form caption that gets duplicated from the insert item to the edited items is an issue our developers will investigate. You can track this issue  through the Public Issue Tracking System (PITS) logging to telerik.com with your Client.NET account.

    As for the edit form and insert form showing together, this is the expected behavior in RadGrid. Particularly, the insert form visibility is not affected by other edit forms visible on page. If you need to synchronize them, meaning only either a single insert form or an edit form is open at a time, you can use RadGrid's ItemCommand  event:

    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.InitInsertCommandName)
        {
            e.Item.OwnerTableView.OwnerGrid.EditIndexes.Clear();
        }
        if (e.CommandName == RadGrid.EditCommandName && e.Item.OwnerTableView.IsItemInserted)
        {
            e.Item.OwnerTableView.GetInsertItem().FireCommandEvent(RadGrid.CancelCommandName, String.Empty);
        }
    }


    Veli
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top