我在出場順序在UI顯示如何使一個特定的下拉菜單選擇先來
- 頁腳
- 頭
- BLABLA
我希望有一個下拉和元素在UI中顯示Header頂部位置的下拉列表。
- 部首
- 頁腳
- BLABLA
代碼UI:
<select id="simTextEditorSelection" onchange="ShowTextEditorBasedOnSelection();" style="float:right;">
@foreach (PageInfoMV anItemForEditor in Model.ItemContents)
{
<option value="@anItemForEditor.ItemId">@anItemForEditor.ItemDisplayText</option>
}
我可以以某種方式在代碼提及上面顯示特定ID作爲默認(TOP位置)。
Model.ItemContents:
public List<PageInfoMV> ItemContents
{
get
{
if (this.itemContents == null) { this.itemContents = new List<PageInfoMV>(); }
if (!this.itemContents.Any(x => x.ItemId == Constants.HEADER_ID))
{
this.itemContents.Add(new PageInfoMV() { ItemId = Constants.HEADER_ID, ItemDisplayText = Constants.HEADER_DISPLAY_TEXT });
}
if (!this.itemContents.Any(x => x.ItemId == Constants.FOOTER_ID))
{
this.itemContents.Add(new PageInfoMV() { ItemId = Constants.FOOTER_ID, ItemDisplayText = Constants.FOOTER_DISPLAY_TEXT });
}
return this.itemContents;
}
set { this.itemContents = value; }
}
Constants.cs
public static readonly string HEADER_ID = "-1000";
public static readonly string FOOTER_ID = "-1001";
它只是一個代碼段。如果需要更多的代碼塊,請讓我知道。謝謝。
Howz'Constants'樣子? –
添加了代碼片段。 – Unbreakable