Home Forums WinForms controls Xceed Grid for WinForms Xceed Grid in Client/Server application Reply To: Xceed Grid in Client/Server application

User (Old forums)
Post count: 23064

I have no experience with .NET remoting, but I’m working on a client/server application that uses web services. I think you can use XML to transfer the data.

Server -> Client:
<b><table><row field1=”abc” field2=”123″/><row field1=”def” field2=”456″/></table></b>

– Clear the <i>DataTable</i>, attached to the grid.
– Use an <i>XmlReader</i> to read the XML-data, and add <i>DataRow</i>s to the <i>DataTable</i>.
– Call the <i>AcceptChanges</i>-method of the <i>DataTable</i>.

Client -> Server:
– Call the <i>GetChanges</i>-method of the <i>DataTable</i> to get a new <i>DataTable</i> containing only the changed rows.
– Use a <i>StringBuilder</i> to create the XML-string, beginning with <b>”<table>”</b>.
– For each row in the <i>DataTable</i> (changed): <b>”<row state=’u’ field1=’abc’ field2=’124’/>”</b>.
– This element has an extra attribute ‘state’: u = update, i = insert, d = delete.
– To know what state to use: check the <i>RowState</i>-property of the <i>DataRow</i>.
– Add <b>”</table>”</b> to the <i>StringBuilder</i>.
– Send the XML-data (<i>StringBuilder</i>.<i>ToString()</i>) to the server.
– Call the <i>AcceptChanges</i>-method of the <i>DataTable</i>.
– Example:
<b><table><row state=”i” field1=”abc” field2=”123″/><row state=”u” field1=”def” field2=”456″/></table></b>

Hope this helps a bit.

Imported from legacy forums. Posted by Tommy (had 4417 views)