We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GridListControl Error: "Cannot clear this list"

Hello,

I am simply trying to clear a GridListControl, but am getting an error on this line:

grdlstPR.Items.Clear();

The error is: "Cannot clear this list."

I am filling the GridListControl using a DataTable:

grdlstPR.DataSource = [Datatable].

Is this what is causing the error? That the "Clear()" method is not implemented for these?

Thanks.
Dave

2 Replies

AD Administrator Syncfusion Team August 8, 2006 03:58 AM UTC

Hi Dave,

You can not modify the Items collection when the DataSource property is set in a gridlist / combobox control. Please try this code to clear the list.

grdlstPR.DataSource = null

Thanks
Haneef


JD Jayant D. Kulkarni December 14, 2006 10:28 AM UTC

I tried this and it works fine...
if (userTable != null)
{
userTable.Clear();
}
userDataGridView.DataSource = null;
userDataGridView.Rows.Clear();
userDataGridView.Refresh();

Loader.
Live Chat Icon For mobile
Up arrow icon