【发布时间】:2015-08-08 12:44:39
【问题描述】:
应该如何在 asp.net 页面中显示复杂的数据对象?实际上下面的类是只读的,数据需要显示在屏幕上,以便代理可以告诉客户他们需要支付多少。我不想编写大量代码来规范化它并在页面上显示它。此数据由 Web 服务方法调用返回。
public class FeeInfo {
private string countryInfoTextField;
public string CountryInfoTextField
{
get{return this.countryInfoTextField;}
set{this.countryInfoTextField= value;}
}
private stringfeeInfoTextField;
public string FeeInfoTextField
{
get{return this.feeInfoTextField;}
set{this.feeInfoTextField= value;}
}
private string taxInfoTextField;
public string TaxInfoTextField
{
get{return this.taxInfoTextField;}
set{this.taxInfoTextField = value;}
}
private string additionalInfoTextField;
public string additionalInfoText
{
get{return this.additionalInfoTextField;}
set{this.additionalInfoTextField = value;}
}
private PromotionInfo[] promotionInfoField; //Class
private SendAmountInfo sendAmountsField; //Class
private EstimatedReceiveAmountInfo receiveAmountsField; //Class
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("promotionInfo")]
public PromotionInfo[] promotionInfo {
get {
return this.promotionInfoField;
}
set {
this.promotionInfoField = value;
}
}
/// <remarks/>
public SendAmountInfo sendAmounts {
get {
return this.sendAmountsField;
}
set {
this.sendAmountsField = value;
}
}
/// <remarks/>
public EstimatedReceiveAmountInfo receiveAmounts {
get {
return this.receiveAmountsField;
}
set {
this.receiveAmountsField = value;
}
}
}
我将上面的内容转换为列表并将其绑定到 gridview,但我看到的只是 4 个字段,而不是最后 3 个复杂属性。在屏幕上显示这些数据的快速方法是什么?
【问题讨论】:
-
最后三个是私有变量。它们不会暴露在类之外。
-
@AmitKumarGhosh 这些变量也有 3 个公共属性,就像其他变量一样。抱歉,我在此处粘贴代码时错过了这一点。刚刚更新了代码。
标签: c# asp.net web-services data-binding