Warum erhalte ich beim Empfang einer POST-Anfrage von Razor View den Wert null anstelle einer leeren Zeichenfolge?
Ich habe eine leere Zeichenfolge empfangen, als es keinen Wert gab:
[HttpPost]
public ActionResult Add(string text)
{
// text is "" when there's no value provided by user
}
Aber jetzt übergebe ich ein Modell
[HttpPost]
public ActionResult Add(SomeModel Model)
{
// model.Text is null when there's no value provided by user
}
So muss ich das @ benutz?? ""
Operator
Warum passiert dies