I have trying to develop a program which will accept an xml-rpc request and update the information in the DataGrid.
Although I were inserted the data into DataTable, the DataGrid will not update automatically. Is there have anything I forgot to done?
The method for handling the xml-rpc request are as following:
/// <param name="this.data">this.data is an instance of DataTable</param>
/// <summary>The method will accept a set of tags and update to data-grid</summary>
[XmlRpcMethod("execute")]
public string execute(string oper, System.Object[] tagsInfo)
{
Console.Out.WriteLine("oper="+oper); //The Operation Name
foreach(Object obj in tagsInfo)
if(obj.GetType().FullName.Equals("CookComputing.XmlRpc.XmlRpcStruct"))
{
XmlRpcStruct tag=(XmlRpcStruct)obj;
DataRow row=this.data.NewRow();
row["id"]=tag["id"];
this.data.Rows.Add(row);
}
try
{
this.datagrid.DataSource=this.data;
this.datagrid.Refresh();
//The result will be increase
Console.Out.WriteLine("DataTable.count="+this.data.Rows.Count);
//The result is always be "0"
Console.Out.WriteLine("DataGrid.count="+this.datagrid.VisibleRowCount);
}
catch(Exception ex){Console.Out.WriteLine(ex);}
return null;
}