Hi everyone I need to send large data from WFC to consumer(in my application i am using windows phone smart device) through JSON.
the code i am using is,
[ServiceContract]
public interface ISampleService
{
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.WrappedRequest, UriTemplate = "GetEmployeeData/{userName}")]
DataSet GetEmployeeData(string userName);
}
public DataSet GetEmployeeData(string userName)
{
DataSet ds = dbServices.GetEmployeeData(userName);
if (ds.Tables[0].Rows.Count > 0)
{
return ds;
}
else
return null;
}
and i receive the data in consumer(windows smart device app) as
HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(url + "GetEmployeeData" + "/" + "manikandan");
webrequest.Method = "POST";
webrequest.ContentType = "application/xml";
webrequest.ContentLength = 0;
Stream stream = webrequest.GetRequestStream();
stream.Close();
string result;
using (WebResponse response = webrequest.GetResponse())
{
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
result = reader.ReadToEnd();
}
}
DataSet ds = new DataSet();
XmlElement exelement;
XmlDocument doc = new XmlDocument();
doc.LoadXml(result);
exelement = doc.DocumentElement;
if (exelement != null)
{
XmlNodeReader nodereader = new XmlNodeReader(exelement);
ds.ReadXml(nodereader, XmlReadMode.Auto);
}
lblCount.Text = ds.Tables[0].Rows.Count.ToString();
lblds.Text = ds.Tables[0].Rows[0][1].ToString();
dataGrid1.DataSource = ds;
when i did all the above the datagrid in the windows mobile is not loaded with the data.
I checked the dataset, by
string val = ds.Tables[0].Rows[0][1].ToString();
it receives the data. now can anybody tell me how to bind my ds to the datagrid in windows smartdevice mobile application.
Thanks in advance.