I have a select list which contains some values representing status of some task.
The values for select list will come from a property in ViewModel. The object representing status also contains path of associate image like:
class Status
{
public int Id{get;set;}
public string Title{get;set;}
public string ImagePath{get;set;}
}
Example values for Rejected status:
var s=new Status{ Id=1, Title="Rejected", ImagePath="~/images/rej.png"};
The image path is relative to root directory.
I wan开发者_运维问答t to display image representing the status on change of the select list in an image besides it. What is the best way to do this using MVC3 Razor?
Do you need to store the reject image for each status?
I would have thought something like a reject image would be generic enough to be handled with Css and an image.
All you would do is change the class with javascript when the select is changed.
If you want to update data in the database on the change event then you can use ajax to post a change back.
Maybe I do not fully understand what it is you are trying to achieve.
But if I do then I would have thought the above would be an elegant way to handle the problem?
精彩评论