2012-09-03 13 views

cevap

2

@ Html.ActionLink ("exportar ark CSV" yeni "ExportToCsv", {cellSeparator = (int) CellSeparators.Semicolon})

ve

public ActionResult ExportToCSV(int cellSeparator) 
{ 
    CellSeparator separator = (CellSeparator)cellSeparator; 
} 

zarif değil ama senin View.cshtml içine

+0

Teşekkür ederiz! Yaklaşımınız çalışıyor. –

+1

Ayrıca RouteValueDictionary http://stackoverflow.com/questions/3976371/pass-collection-of-enums-to-asp-net-mvc-actionmethod –

2

yararlıdır:

@Html.ActionLink("Exportar al CSV", "ExportToCSV", new { cellSeparator=CellSeparators.Semicolon }) 

Kontrolörünüzün içine:

public ActionResult ExportToCSV(CellSeparators? cellSeparator) 
{ 
    if(cellSeparator.HasValue) 
    { 
    CellSeparator separator = cellSeparator.Value; 
    } 

    /* ... */ 
} 
İlgili konular