开发者

gridview datasource issue

开发者 https://www.devze.com 2022-12-25 17:46 出处:网络
I am calling a webservice as follows.I have to display name, description and url in the gridview using this webservice.

I am calling a webservice as follows.I have to display name, description and url in the gridview using this webservice.

using sdi.amiller_v_vista;

sdi.amiller_v_vista.DDCControl proxy1 = new sdi.amiller_v_vista.DDCControl();
sdi.amiller_v_vista.DDCReturnGetAll ret = proxy1.GetAllDDCs(x, y);

foreach (sdi.amiller_v_vista.DDCInfo2 di2 in ret.DDCs)
{
    GridView1.DataSource = I have to assign the di2 values(di2 is having name, description and url for each ddc) to gridview datasource

   //GridView1.DataSource = ret.DDCs[i] throws an error Data source is an invalid type.  It must be either an IListSource, IEnumerable, or IDataSource.

   GridView1.DataBind();
}

From WSDL metadata i can get the follwing info

public DDCReturnGetAll GetAllDDCs(Guid accountId, Guid authToken);

public class DDCReturnGetAll : DDCReturnBase
{
    public DDCReturnGetAll();
    public DDCInfo2[] DDCs { get; set; }
}

public class DDCInfo2
{
    public DDCInfo2();
    public BrandingType brandingType { get; set; }
    public string ChargebackName { get; set; }
    public string CollectorName { get; set; }
  开发者_C百科  public string Description { get; set; }
    public string URL { get; set; }
}


Its difficult to tell from your sample, but you probably want to do something similar to replacing this:

foreach (sdi.amiller_v_vista.DDCInfo2 di2 in ret.DDCs) {
  GridView1.DataSource = I have to assign the di2 values to gridview datasource
  //GridView1.DataSource = ret.DDCs[i] throws an error Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.
  GridView1.DataBind();
}

with this:

  GridView1.DataSource = ret.DDCs
  GridView1.DataBind();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号