DropDownListForModel无法添加HTML属性

时间:2018-08-06 14:25:33

标签: c# asp.net razor

我试图将html属性添加到该下拉列表中,如下所示:

@Html.DropDownListForModel(p => p.PreviousCompanyCompletedMappingId, Model.PreviousCompanyMappings.ToSelectListItems(), new { @class = "dropdown" })

但是我遇到了错误:Argument 4: cannot convert from '<anonymous type: string class>' to 'string'

1 个答案:

答案 0 :(得分:3)

编译器在识别要使用的正确方法重载时遇到问题。为import { formValueSelector } from 'redux-form' // ES6 const mapStateToProps = state => { const selector = formValueSelector('myFormName') const firstName = selector(state, 'firstname') return { firstName } } 参数明确指定null

optionLabel