导航到上一页时重新填充 syncfusion 组合框
Re-populate syncfusion combobox when navigating to previous page
我有一个问题。我在 syncfusion 中有一个组合框。组合框填充有值。当我 select 一个值并导航到另一个页面,然后返回到上一页时,我在组合框中 selected 的 selected 项目不会出现。
我已将 selected 项目存储在会话中。
@Html.EJ().DropDownList("selectCars").Datasource((IEnumerable<object>)
ViewBag.datasourcex).DropDownListFields(df => df.ID("CarId").Text("CarsFile").Value("CarsFile")).
WatermarkText(Cars.Resources.Resource.SwitchCar).CssClass("headerTextRed").Wid
会话定义如下:
var carsSessions = new CarsSessions();
// some attributes defined in the session..
carsSessions.ClientKey = decryptedClientKey;
carsSessions.Language = langueinit;
carsSessions.DossierIdFile = string.Empty;
问题是,当我导航到上一页时,如何使用我之前 select 编辑过的 select 编辑项填充 syncfusion
组合框?
我们建议您将 DropDownList 的 enablePersistance 属性 设置为 true,这样即使在页面导航之后,所选项目也会保留在下拉列表中。请参考以下代码
@Html.EJ().DropDownList("selectCars")
.Datasource((IEnumerable<object>)ViewBag.datasourcex)
.Width("250px").DropDownListFields(df =>
df.ID("CarId").Text("CarsFile").Value("CarsFile"))
.WatermarkText("Select a Car")
.CssClass("headerTextRed").EnablePersistence(true)
@Html.ActionLink("Navigate to Index Page", "Index", "Home")
我们准备了一个示例供您参考,可以从这里下载link
此外,请参阅 UG 了解更多详情
我有一个问题。我在 syncfusion 中有一个组合框。组合框填充有值。当我 select 一个值并导航到另一个页面,然后返回到上一页时,我在组合框中 selected 的 selected 项目不会出现。
我已将 selected 项目存储在会话中。
@Html.EJ().DropDownList("selectCars").Datasource((IEnumerable<object>)
ViewBag.datasourcex).DropDownListFields(df => df.ID("CarId").Text("CarsFile").Value("CarsFile")).
WatermarkText(Cars.Resources.Resource.SwitchCar).CssClass("headerTextRed").Wid
会话定义如下:
var carsSessions = new CarsSessions();
// some attributes defined in the session..
carsSessions.ClientKey = decryptedClientKey;
carsSessions.Language = langueinit;
carsSessions.DossierIdFile = string.Empty;
问题是,当我导航到上一页时,如何使用我之前 select 编辑过的 select 编辑项填充 syncfusion
组合框?
我们建议您将 DropDownList 的 enablePersistance 属性 设置为 true,这样即使在页面导航之后,所选项目也会保留在下拉列表中。请参考以下代码
@Html.EJ().DropDownList("selectCars")
.Datasource((IEnumerable<object>)ViewBag.datasourcex)
.Width("250px").DropDownListFields(df =>
df.ID("CarId").Text("CarsFile").Value("CarsFile"))
.WatermarkText("Select a Car")
.CssClass("headerTextRed").EnablePersistence(true)
@Html.ActionLink("Navigate to Index Page", "Index", "Home")
我们准备了一个示例供您参考,可以从这里下载link
此外,请参阅 UG 了解更多详情