Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input type="Tags" type="text" id="Tags" name="Tags"/>
- ...
- public class Question
- {
- public string Title { get; set; }
- public string Body { get; set; }
- public LazyList<string> Tags { get; set; }
- }
- ....
- var question = new Question();
- this.UpdateModel(question, new [] { "Title", "Body", "Tags" });
- UpdateModel(q, new[] { "Title", "Body", "Tags" },
- new QuestionValueProvider(this.ControllerContext));
- public class QuestionValueProvider : DefaultValueProvider
- {
- public QuestionValueProvider(ControllerContext controllerContext)
- : base(controllerContext)
- {
- }
- public override ValueProviderResult GetValue(string name)
- {
- ValueProviderResult value = base.GetValue(name);
- if (name == "Tags")
- {
- List<string> tags = new List<string>();
- string[] splits = value.AttemptedValue.Split(' ');
- foreach (string t in splits)
- tags.Add(t);
- value = new ValueProviderResult(tags, null, value.Culture);
- }
- return value;
- }
- }
Add Comment
Please, Sign In to add comment