Having trouble getting help?
Contact Support
Contact Support
State Persistence in ASP.NET MVC
4 Dec 20241 minute to read
The Syncfusion® ASP.NET MVC library supports persisting a control’s state across page refreshes or navigation. To enable this feature, set enablePersistence
property as true to the required control. This will store the control’s state in browser’s localStorage
object on page unload
event.
@Html.EJS().Grid("check").DataSource(dataManger =>
{
dataManger.Url("http://services.odata.org/V4/Northwind/Northwind.svc/Products").CrossDomain(true).Adaptor("ODataV4Adaptor");
}).Columns(col =>
{
col.Field("ProductID").HeaderText("Product ID").Width("120").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("ProductName").HeaderText("Product Name").Width("150").Add();
col.Field("UnitPrice").HeaderText("Supplier ID").Width("130").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("UnitsInStock").HeaderText("QuantityPerUnit").Width("120").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("Discontinued").HeaderText("Discontinued").Width("140").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Center).Type("boolean").DisplayAsCheckBox(true).Add();
})
.EnablePersistence()
.AllowPaging()
.PageSettings(page=>page.PageCount(5))
.Render()
State Persistence Supported controls and Properties
The following table demonstrates the list of Syncfusion® ASP.NET MVC controls that are supported with state persistence and describes the list of properties stored in the localStorage
.
control Name | Properties |
Grid |
|
Accordion |
|
Tabs |
|
Schedule |
|
Kanban |
|
Chart |
|
Maps |
|
Pivot Table |
|
TreeGrid |
|
Switch |
|
Checkbox |
|
RadioButton |
|
ColorPicker |
|
ListBox |
|
QueryBuilder |
|
In-placeEditor |
|
RichTextEditor |
|
Splitter |
|
Autocomplete |
|
Calendar |
|
ComboBox |
|
DatePicker |
|
DropDownList |
|
MaskedTextBox |
|
NumericTextBox |
|
Textbox |
|
TimePicker |
|
Multiselect |
|
DateTimePicker |
|
DateRangePicker |
|
Uploader |
|
Slider |
|
ListView |
|
TreeView |
|
Dashboard Layout |
|
File Manager |
|
Sidebar |
|
Dropdown Tree |
|