![](/img/trans.png)
[英]ASP.NET MVC DropDownList doesn't show the colour when it is active
[英]ASP.NET MVC razor DropDownList doesn't show the KendoGrid
我有一個ASP.NET MVC DropDownList:
@{var selectionList = new List<SelectListItem>
{
new SelectListItem { Text = "All Patients", Value="All Patients" },
new SelectListItem { Text = "Chosen Patients", Value="Chosen Patients" }
};
}
@Html.DropDownList("Selection",new SelectList(selectionList,"Value","Text"))
我還有一個KendoGrid,在單擊以下列表項之前,應將其隱藏:“ Chosen Patient”:
<script type="text/javascript">
$('#CheckedPatientsRep').hide();
</script>
這是KendoGrid:
@(Html.Kendo().Grid<RunSummary>()
.Name("CheckedPatientsRep")
//.Events( events => events.DataBinding("onDataBinding"))
.DataSource(datasource => datasource
.Ajax().PageSize(25)
.ServerOperation(false)
.Sort(sort => sort.Add("UniqueId").Ascending())
.Read(read => read.Action("GetRunSummaries", "PatientReport")))
.Columns(columns =>
{
等等。我想在DropDownList中單擊“選擇患者”后顯示KendoGrid。 這是我的點擊代碼:
<script>
$("#Selection").click(function () {
var selectedValue = $(this).find('option:selected').val();
if (selectedValue.toLower() == "chosen patients") {
$('#CheckedPatientsRep').show();
}
});
</script>
我有兩個問題:首先不隱藏KendoGrid,其次是單擊不起作用。 如何解決呢? 預先感謝您的任何幫助。
現在一切都很好:)。 我只把代碼
<script type="text/javascript">
$('#CheckedPatientsRep').hide();
</script>
在KendoGrid之前。 單擊的代碼也可以使用,除了它應使用函數toLowerCase()而不是toLower()。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.