如何在Windows Phone中显示json数据 [英] how to display the json data in windows phone
问题描述
我创建了一个Web服务,我目前正在使用它在html面板上显示数据(.aspx页面上的html表)。现在我想制作一个Windows手机应用程序,它将在手机屏幕上显示数据。
但我是Windows手机和耳机的新手不知道帆布和&显示方法,所以如果有人知道如何实现它,请告诉我...提前谢谢你
i将数据绑定到我的下面给出的代码的html面板--->
i'v created a web service, and i am currently using it to display the data on a html panel (html table on .aspx page). now i want to make a windows phone application, which will display the data on the phone screen.
but i m new to windows phone & have no idea about canvas & display methods in this, so if anyone have any idea that how it can be achieved than please tell me... thank u in advance
i was binding that data into my html panel by this code given below--->
function BindData(result) {
result = JSON.parse(result)
if (result != null && result.Status && result.data != null && result.data.length > 0) {
var currentRow = 0;
for (var rows = 0; rows < result.data.length; rows++) {
var row = result.data[rows]
for (var cols = 0; cols < row.length; cols++) {
var divId = "#R" + currentRow + "C" + cols;
if (arrayRowCol[divId] == undefined || arrayRowCol[divId] == null) {
continue;
}
var oldValue = $(divId).text();
var newValue = row[cols]
$(divId).text(newValue)
//// some code
我收到的`data`是字符串格式&我认为必须在某些objectType中进行转换(在这种情况下,当我在上面给出的html面板中显示数据时,我将其转换为jsonObject)。
我已经编写了从Web服务中检索数据的代码--->
the `data` i am receiving, is in string format & i think it has to be converted in some objectType (in that case, i was converting it into an jsonObject when i was displaying the data in my html panel as given above).
I have already written the code to retrieve the data from the web service--->
InitializeComponent();
WebClient wc = new WebClient();
wc.DownloadStringAsync(new Uri(some url));
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
}
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
// code ??????????
}
那么xAML代码&绑定此数据的方式或过程(`e.Result`)?**
so what will be **the XAML code & the way or procedure to bind this data(`e.Result`) ?**
推荐答案
(divId).text();
var newValue = row [cols]
(divId).text(); var newValue = row[cols]
(divId).text(newValue)
////一些代码
(divId).text(newValue) //// some code
我收到的`data`是字符串格式&我认为必须在某些objectType中进行转换(在这种情况下,当我在上面给出的html面板中显示数据时,我将其转换为jsonObject)。
我已经编写了从Web服务中检索数据的代码--->
the `data` i am receiving, is in string format & i think it has to be converted in some objectType (in that case, i was converting it into an jsonObject when i was displaying the data in my html panel as given above).
I have already written the code to retrieve the data from the web service--->
InitializeComponent();
WebClient wc = new WebClient();
wc.DownloadStringAsync(new Uri(some url));
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
}
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
// code ??????????
}
那么xAML代码&绑定此数据的方式或过程(`e.Result`)?**
so what will be **the XAML code & the way or procedure to bind this data(`e.Result`) ?**
请使用网页视图查看html面板中添加的数据。
谢谢,
Bilaal
Please use web view to see the added data in your html panel.
Thanks,
Bilaal
这篇关于如何在Windows Phone中显示json数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!