Hi,
I have a dropdownlistfor that uses templates to display an image for each dropdown entry
I am having trouble retrieving the correct data.
@(Html.Kendo().DropDownListFor(model => model.Image0Id)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetImageIds", "Home");
read.Type(HttpVerbs.Post);
});
})
.Template("<img src='" + @Url.Action("GetImage", "Home", new { imageId = "#=data#"}) + "' width='128' height ='51'/>")
.OptionLabel("None")
.AutoBind(true)
)
The #=data# is actually returning my ViewModel so when pass value to GetImage() I have a problem.
If I replace #=data# with say the number 2, the template works and fetches my image with id of 2.
If I insert some javascript #{alert(data)#} to alert me of the data values returned by GetImageIds() it returns the expected values.
I am using this in a similar scenario elsewhere where my template is as follows:
.Template("<img src='" + @Url.Content("~/Images/Banners/#=data#") + "' width='128' height ='51'/>")
This works perfectly.
Anybody have any ideas here?
I have a dropdownlistfor that uses templates to display an image for each dropdown entry
I am having trouble retrieving the correct data.
@(Html.Kendo().DropDownListFor(model => model.Image0Id)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetImageIds", "Home");
read.Type(HttpVerbs.Post);
});
})
.Template("<img src='" + @Url.Action("GetImage", "Home", new { imageId = "#=data#"}) + "' width='128' height ='51'/>")
.OptionLabel("None")
.AutoBind(true)
)
The #=data# is actually returning my ViewModel so when pass value to GetImage() I have a problem.
If I replace #=data# with say the number 2, the template works and fetches my image with id of 2.
If I insert some javascript #{alert(data)#} to alert me of the data values returned by GetImageIds() it returns the expected values.
I am using this in a similar scenario elsewhere where my template is as follows:
.Template("<img src='" + @Url.Content("~/Images/Banners/#=data#") + "' width='128' height ='51'/>")
This works perfectly.
Anybody have any ideas here?