将新值添加到下拉列表中

时间:2017-07-14 09:05:21

标签: c# model-view-controller

我有一个包含以下值的下拉列表:

  

0,10,20,30。

现在我想用“关闭”替换0 我用来显示值的逻辑是

List<int> refreshList = GetAutoRefreshTimeIntervals();
this.dataSetVM.RefreshIntervalList = new SelectList(refreshList);

// The default value in the drop down should be 30 which should be config driven.
// If the configuration has any invalid value other than the valid entries in the Dropdown, the default value of 30 should be used.
if (refreshList.Contains(refreshInterval))
{
     this.dataSetVM.RefreshInterval = refreshInterval;
}
else
{
     this.dataSetVM.RefreshInterval = 30; // default will be set as 30
}

0 个答案:

没有答案