1
Vote

mvc HtmlHelper.GetModelStateValue bug

description

this method should be public, and check modelstate value is not null.
 
    public object GetModelStateValue(string key, Type destinationType)
    {
        ModelState modelState;
        if (ViewData.ModelState.TryGetValue(key, out modelState))
        {
            if (modelState.Value != null)
            {
                return modelState.Value.ConvertTo(destinationType, null /* culture */);
            }
        }
        return null;
    }

comments