我有DropDownListFor
绑定到我的模型中名为BinRangeSelection
的字段。当我在此下拉列表中选择一个值时,BinRangeSelection值不会更改,它将保持为null。这是我的下拉:
@Html.DropDownListFor(m => m.BinRangeSelection, new SelectList(Model.BinRanges), "Select BIN Range", new { id = "BinRangesDropDown_start", @class = "five columns" })
我的BinRangeSelection
字符串:
private String _BinRangeSelection;
public String BinRangeSelection
{
get
{
return _BinRangeSelection;
}
set
{
System.Diagnostics.Debug.WriteLine("testing");
string[] rangeSplit = Regex.Split(value, " - ");
foreach (IdentifiBINConfiguration ibc in IdentifiBINConfigs)
{
if (ibc.LowerRange == rangeSplit[0] && ibc.UpperRange == rangeSplit[1])
{
IdentifiBINConfiguration = ibc;
}
}
_BinRangeSelection = value;
BinRangeSelection = value;
}
}
testing
语句永远不会打印到控制台,我已经设置了断点,并且调用了set函数中的任何内容。