0
嗨,我有一个列表,它被设置为网格视图的数据源。我的网格视图看起来像这样。如何透视C#中的网格视图
Green| Gold | Grade
----|---- | -------
2 | 1 | 100
3 | 1 | 101
- | 3 | 102
3 | - | 104
- | - | 105
8 | 5 | Total
但我想这样
Grade |100 |101 |102 |103 |104 |105 |Total
--------- |---- |----|----|----|----|----|-----
Green |2 |3 |- |3 |8 |- |8
Gold |1 |1 |3 |- |3 |- |5
这是我的列表类
public class Value
{
public string Gold { get; set; }
public string Grade { get; set; }
public string Green { get; set; }
}
public class GetCACPopGuideResult
{
public object Type { get; set; }
public List<Value> Value { get; set; }
}
这是我的代码
GetCACPopGuideResult result = getvalue();// Get the values to display
GridView1.DataSource= result.Value;
Public GetCACPopGuideResult getvalue()
{
string URL= myURL;
var cli = new RestClient(URL);
IRestRequest auctionRequest = new RestRequest(Method.GET);
IRestResponse responseCustomer = cli.Execute(auctionRequest);
return responseCustomer.Content;
}
做的是有一个我可以在C#中做到这一点?请帮帮我。
在此先感谢
你是从数据库中获取数据?然后提供SQL else provode getvalue()实现。 – Imad
感谢您的回放,我修改了网格。 –
它不是来自数据库。它来自Web服务。它只是调用web服务并加载所有数据。我已经添加了该getdata的代码请看看。 –