DropDownList不修改绑定

时间:2015-06-22 20:40:25

标签: c# asp.net asp.net-mvc

我有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函数中的任何内容。

0 个答案:

没有答案