【发布时间】:2012-08-27 09:43:46
【问题描述】:
我在向 GridControl 添加行/单元格值时遇到问题。 我使用 Web 服务作为数据源。 我的 Web 服务功能运行完美并返回 xml 类型的值 例如
<User>
<UserID>000015</UserID>
<UserGroup>MR</UserGroup>
<UserName>ARIF SETYOWARDOYO</UserName>
<IsActive>1</IsActive>
</User>
我将 Web 服务作为“添加服务”添加到我的项目中。 而且,我的 BindingSource 代码:
userBindingSource.DataSource = typeof(DXWindowsApplication1.WebService.User);
我已将 BindingSource 附加到 GridControl,它会自动创建 4 列,分别是 UserID、UserGroup、UserName 和 IsActive。
但他们的行中没有数据。如果我在下面运行此脚本,它将运行并返回值..
WebService.MyWebServiceWs = new WebService.MyWebServiceWs ();
WebService.User[] user = Ws.GetUserDetails();
string userId = user[0].UserID.ToString();
string userGroup = user[0].UserGroup.ToString();
string userName = user[0].UserName.ToString();
string isActive = user[0].IsActive.ToString();//int isActive = user[0].IsActive.Value;
所以我的问题是,接下来我该怎么做才能将这个 WebService 数据检索到 GridControl 中?
任何参考将不胜感激...
谢谢 :)
干杯..
【问题讨论】:
标签: c# winforms devexpress bindingsource gridcontrol