c# – 如何将枚举值传递给@ Html.ActionLink

前端之家收集整理的这篇文章主要介绍了c# – 如何将枚举值传递给@ Html.ActionLink前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我有一些方法

  1. public ActionResult ExportToCSV(CellSeparators cellSeparator)
  2. {
  3. //
  4. }
  5. public enum CellSeparators
  6. {
  7. Semicolon,Comma
  8. }

我们如何在html中正确引用该方法

  1. @Html.ActionLink("Exportar al CSV","ExportToCSV",new { ?? })

谢谢!

最佳答案
@ Html.ActionLink(“Exportar al CSV”,“ExportToCSV”,new {cellSeparator =(int)CellSeparators.Semicolon})

  1. public ActionResult ExportToCSV(int cellSeparator)
  2. {
  3. CellSeparator separator = (CellSeparator)cellSeparator;
  4. }

不优雅,但很有用

猜你在找的HTML相关文章