Last change
on this file since 10042 was
9582,
checked in by fschoepp, 12 years ago
|
#1888:
- Added an overview for users to inspect their orders
- Order Administrators may now suspend or reactivate orders
- When creating an order, its necessary to enter payment information (paypal, credit card,...) before
- Also, the billing period and type must be entered during the creation of an order.
|
File size:
1.3 KB
|
Rev | Line | |
---|
[9582] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Web;
|
---|
| 5 | using System.Web.Mvc;
|
---|
| 6 | using System.Linq.Expressions;
|
---|
| 7 | using System.Text;
|
---|
| 8 | using System.Web.Mvc.Html;
|
---|
| 9 |
|
---|
| 10 | namespace HeuristicLab.Services.Optimization.Web.Helpers {
|
---|
| 11 | // http://stackoverflow.com/questions/5621013/pass-enum-to-html-radiobuttonfor-mvc3
|
---|
| 12 | public static class HtmlExtensions {
|
---|
| 13 | public static MvcHtmlString RadioButtonForEnum<TModel, TProperty>(
|
---|
| 14 | this HtmlHelper<TModel> htmlHelper,
|
---|
| 15 | Expression<Func<TModel, TProperty>> expression
|
---|
| 16 | ) {
|
---|
| 17 | var metaData = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);
|
---|
| 18 | var names = Enum.GetNames(metaData.ModelType);
|
---|
| 19 | var sb = new StringBuilder();
|
---|
| 20 | foreach (var name in names) {
|
---|
| 21 | var id = string.Format(
|
---|
| 22 | "{0}_{1}_{2}",
|
---|
| 23 | htmlHelper.ViewData.TemplateInfo.HtmlFieldPrefix,
|
---|
| 24 | metaData.PropertyName,
|
---|
| 25 | name
|
---|
| 26 | );
|
---|
| 27 |
|
---|
| 28 | var radio = htmlHelper.RadioButtonFor(expression, name, new { id = id }).ToHtmlString();
|
---|
| 29 | sb.AppendFormat(
|
---|
| 30 | "<label for=\"{0}\">{1}</label> {2}",
|
---|
| 31 | id,
|
---|
| 32 | HttpUtility.HtmlEncode(name),
|
---|
| 33 | radio
|
---|
| 34 | );
|
---|
| 35 | }
|
---|
| 36 | return MvcHtmlString.Create(sb.ToString());
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.