public class MyController { public ActionResult MyAction(string DropDownListName) { } }@H_403_7@ 这将为MasterMind的答案中的代码行做.您想要使用哪种方法取决于您的情况.在我看来,没关系 如果所有可能的选择值都是数字,您也可以这样做: public class MyController { public ActionResult MyAction(int DropDownListName) { } }@H_403_7@ 然后,它会将所选值的字符串转换为整数.
这将为MasterMind的答案中的代码行做.您想要使用哪种方法取决于您的情况.在我看来,没关系
如果所有可能的选择值都是数字,您也可以这样做:
public class MyController { public ActionResult MyAction(int DropDownListName) { } }@H_403_7@ 然后,它会将所选值的字符串转换为整数.
然后,它会将所选值的字符串转换为整数.