我有一个问题。我有一个同步组合框。组合框中填充了值。当我选择一个值并导航到另一个页面,然后返回上一页时,我在组合框中选择的所选项目不会出现。
我已将所选项目存储在会话中。
@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;
问题是如何在导航到上一页之前使用我选择的所选项目填充syncfusion
组合框?
答案 0 :(得分:1)
我们建议您将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了解更多详情