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

how to remove row from grid

1 Answer 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mohsinjk jk
Top achievements
Rank 1
mohsinjk jk asked on 26 Jul 2010, 09:15 AM
Hi,

I want to remove row from grid not from my database. When user click on Remove button then it just remove from my grid.

thanks

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 26 Jul 2010, 09:55 AM
Hello Mohsinjk,

You couldn't actually remove the row since RadGrid is a databound control - you could hide it instead. For that purpose, you should persist the "removed" rows in an array as demonstrated below:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem  item = e.Item as GridDataItem;
        if(myHiddenItemsCollection.Contains(item.GetDataKeyValue("MyID").ToString()))
            item.Visible = false;
    }
}

Best regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
mohsinjk jk
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or