प्रस्तुत मैं इस पोस्ट पर निर्देशों का पालन किया: Asp.net mvc3 razor with multiple submit buttons और यहाँ मेरे मॉडल है:MVC4 - एक प्रपत्र 2 बटन
public class AdminModel
{
public string Command { get; set; }
}
मेरे नियंत्रक
[HttpPost]
public ActionResult Admin(List<AdminModel> model)
{
string s = model.Command;
}
मेरे देखें
@using (Html.BeginForm("Admin", "Account"))
{
<input type="submit" name="Command" value="Deactivate"/>
<input type="submit" name="Command" value="Delete"/>
}
जब मैं वापस पोस्ट करता हूं, तो स्ट्रिंग "हमेशा" शून्य होती है।
मैंने इस मंच पोस्ट में दूसरे उत्तर (146 वोट वाले एक) की भी कोशिश की: How do you handle multiple submit buttons in ASP.NET MVC Framework? और यह भी शून्य है। मैं क्या गलत कर रहा हूं?
http://stackoverflow.com/questions/2423041/using -टवो-सबमिट-बटन-अंदर-एकल-फॉर्म/2426152 # 2426152 इसके बारे में कैसे? – takepara