0

I have a problem with adding rows/cells values to GridControl. I am using Web Service as data source. My web service function runs perfectly and returns an xml type of value e.g.

<User>
<UserID>000015</UserID>
<UserGroup>MR</UserGroup>
<UserName>ARIF SETYOWARDOYO</UserName>
<IsActive>1</IsActive>
</User>

I added my web service to my project as 'Add Services'. And, my BindingSource code:

userBindingSource.DataSource = typeof(DXWindowsApplication1.WebService.User);

I have attached my BindingSource to the GridControl, and it automatically creates 4 columns, which are UserID, UserGroup, UserName, and IsActive.
but there's no data in their rows. If I run this script below, it'd run and return the values..

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;



so my question is, what am I to do next to get retrieve this WebService data into GridControl?
any reference would be really appreciated...
Thank You :)
Cheers..

devilkkw
  • 418
  • 2
  • 6
  • 17
choz
  • 17,242
  • 4
  • 53
  • 73

1 Answers1

0

i read xml from web without webservice,and poupolate my table with this code:

// needed variable
private DataSet ds;
//read xml and poupolate table
 System.Xml.XmlDataDocument xmlDatadoc = new System.Xml.XmlDataDocument();

                xmlDatadoc.DataSet.ReadXml("http://your link to xml");
                ds = xmlDatadoc.DataSet;



                datagridviwe1.DataSource = ds.DefaultViewManager;
                datagridviwe1.DataMember = "User";

but you need some change in our xml file,this is an example:

<User UserID="000015" UserGroup="MR" UserName="ARIF SETYOWARDOYO" IsActive="1" />
<User UserID="000016" UserGroup="MRS" UserName="LADY LAYON" IsActive="0" />

This poupolate table with all value,for personalize showed content you need to bindingsource with your xsd schema and edit table generate.

devilkkw
  • 418
  • 2
  • 6
  • 17
  • Hi devilkkw, Thanks for your reply. it's really inspirating me to move forward. But, I still have problem in this situation coz I have to use webservice and I don't know how I can change that xml format. – choz Aug 27 '12 at 11:27
  • i think for use your webservice,you need to create array for all data recived,then use it for generate datagrid(method foreach).I've not try this method,and i didn't help you with sample code.sorry. – devilkkw Aug 27 '12 at 11:40