如何使用mvc在数组推送概念中加载图像?

时间:2017-11-01 13:02:05

标签: javascript c# asp.net asp.net-mvc asp.net-mvc-4

在数据推送循环中,我从数据库获取所有数据,包括医生ID。从医生ID如何从图像文件夹位置获取图像。

@foreach (DoctorView doctor in Model.DoctorViews)
            {
                @:myArray.push("@doctor.DoctorID","<img src="@Url.Content(String.Format("~/Doctor/" + doctor.DoctorID + ".png"))" />", "@doctor.DoctorName", "@doctor.Email", "@doctor.CountryName", "@doctor.City", "@doctor.Mobile");

            }

        var data = [];

        for (var i = 0; i < myArray.length; i++) {

            data.push({
                "id": myArray[i],
                //"name": "Draft",
                "doctorName": myArray[i + 1],
                "email": myArray[i + 2],
                "country": myArray[i + 3],
                "city": myArray[i + 4],
                "mobile": myArray[i + 5]

            })

            i = i + 5;
        }

0 个答案:

没有答案