-1
你好基本上我想要一個下拉列表來顯示員工姓名列表,當管理員或管理人員正在使用它時選擇圖表必須顯示的名稱。這可能嗎?如果有,請幫我...我如何獲得一個下拉列表,當選擇一個值來顯示mvc中使用mvc圖表助手的圖表中的員工值時?
public ActionResult CharterColumn()
{
var results = (from c in db.Clockcards select c);
// the employeeid is a foreign key in the clockcards table
// i want to get the name from the employee table
// and display only that employees hours worked for the months
var groupedByMonth = results
.OrderByDescending(x => x.CaptureDate)
.GroupBy(x => new { x.CaptureDate.Year, x.CaptureDate.Month }).ToList();
List<string> monthNames = groupedByMonth
.Select(a => a.FirstOrDefault().CaptureDate.ToString("MMMM"))
.ToList();
List<double> hoursPerMonth = groupedByMonth
.Select(a => a.Sum(p => p.Hours))
.ToList();
ArrayList xValue = new ArrayList(monthNames);
ArrayList yValue = new ArrayList(hoursPerMonth);
new Chart(width: 800, height: 400, theme: ChartTheme.Yellow)
.AddTitle("Chart")
.AddSeries("Default", chartType: "Column", xValue: xValue, yValues: yValue)
.Write("bmp");
return null;
}
這是我的看法
<div>
<img src= "@Url.Action("CharterColumn")" alt="Chart"/>
</div>
您的代碼中沒有關於下拉列表的任何內容! –
我在問是否可以用mvc圖表做這個,如果有的話我該怎麼做 – Kimberly