-2

您好朋友,我从 Web 服务获取数据,所以我不能使用 Html.DisplayFor(model=>model.item) 以及如何在数组中显示数据。这是我的代码:

@using icerik.TahakkukServices


@{
    ViewBag.Title = "Deneme";
    Layout = "~/Views/Shared/_Layout5.cshtml";
}


@{
    TahakkukServicesClient client = new TahakkukServicesClient();
    client.ClientCredentials.UserName.UserName = "service_test";
    client.ClientCredentials.UserName.Password = "";
    client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
    MakbuzList[] liste = client.GetMakbuzListe(2);

}

 @foreach (var item in liste)
 {

Html.DisplayFor(item.Adi)
                }
4

2 回答 2

1

@model icerik.TahakkukServices。添加您的表名

@{ 
    ViewBag.Title = "Deneme"; 
    Layout = "~/Views/Shared/_Layout5.cshtml"; 
} 


@{ 
    TahakkukServicesClient client = new TahakkukServicesClient(); 
    client.ClientCredentials.UserName.UserName = "service_test"; 
    client.ClientCredentials.UserName.Password = ""; 
    client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None; 
    MakbuzList[] liste = client.GetMakbuzListe(2); 

} 

 @foreach (var item in liste) 
 { 

Html.DisplayFor(model=>model.) add your column name
                } 
于 2012-08-31T12:26:20.197 回答
0

好的,我知道如何在您的服务中提供型号名称,如下所示

@model icerik.TahakkukServices.Borc

所以你可以使用 Html.DisplayFor

于 2012-08-31T12:17:48.753 回答