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

How do I cancel edit-, insert-form by code?

3 Answers 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Henrik
Top achievements
Rank 1
Henrik asked on 02 Jan 2011, 09:20 AM
I want to cancel edit-, insert-form in my needdatasource when I bind a new table when the previous table had an a form opened up! (otherwhise this will cause problems!

//h

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Jan 2011, 09:18 AM
Hello,


Have you tried following code to close edit/insert form after setting new DataSource to grid?

Code:
RadGrid1.EditIndexes.Clear();
RadGrid1.MasterTableView.IsItemInserted = false;
RadGrid1.MasterTableView.Rebind();

Feel free to share the comments..


-Shinu.
0
Henrik
Top achievements
Rank 1
answered on 03 Jan 2011, 10:52 AM
Yep thats how I do it and I also clear sort and filter ...

Can't we just clear viewstate of grid in anyway to just reset it? Or this is the only way to reset:

With TableGrid
    .MasterTableView.CurrentPageIndex = 0       'Make sure we always move to page 1
    .MasterTableView.FilterExpression = ""      'Clear Filters
    .MasterTableView.SortExpressions.Clear()    'Clear sort
    .Columns.Clear()                            'Removes all columns
    .EditIndexes.Clear()                        'Closes edit forms
    .MasterTableView.IsItemInserted = False     'Closes Insertform
End With

Have I forgot anything that I also have to clear/clean?

//h
0
Pavlina
Telerik team
answered on 03 Jan 2011, 12:37 PM
Hi Henrik,

Please take a look at the Optimizing ViewState usage help topic to see the limitations of a grid with disabled ViewState.

I hope this helps.

Greetings,
Pavlina
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.
Tags
Grid
Asked by
Henrik
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Henrik
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or