Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025

 


Article

Form model returning null after submit on a custom MVC widget

« Go Back

Information

 
Article Number000097908
EnvironmentProduct: Sitefinity
Version: 6.x, 7.x, 8.x, 9.x, 10.x, 11.x, 12.x
OS: All supported OS versions
Database: All supported Microsoft SQL Server versions
Question/Problem Description
Form model returning null after submit on a custom MVC widget

E.j:
 
@using (Html.BeginForm())
{
        @Html.LabelFor(model => model.CaseTitle, htmlAttributes: new { @class = "sf_colsOut sf_2cols_1_25" })
       <input type="submit" value="Search" class="blue-link-button"
}



When clicking submit, an Index(Model model) method on the controller is called however the associated model does not contain the user provided values.

 
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
There are no input controls associated to the model's property(or properties) for the user to enter information.  
Resolution
Add an input element for the user to enter the value for the property of the model. 

E.g: 
 
@Html.TextBoxFor(model => model.CaseTitle, new { htmlAttributes = new { @class = "sf_colsOut sf_2cols_2_75" } })

 
Workaround
Notes
Attachment 
Last Modified Date8/13/2019 5:16 PM