Hi
I am passing data to a kendoUI gird and the data doesn't display.
I'm new to this and am probably making a basic mistake.
My controller code is:
public ActionResult GetDataFromStream(string streamName)
{
string temp = OpenHttpGETConnection(streamName);
string[] split = temp.Split(new Char [] {'\r'});
//var myList = new List<dynamic>();
List<DisplayData> myList = new List<DisplayData>();
foreach (string s in split)
{
if(s!=null){
string[] strTemp = new string[2];
strTemp = s.Split(new Char[] { '\t' });
myList.Add
(new DisplayData
{
key = strTamp[0]
value = strTemp[1]
});
}
}
return Json(myList);
}
My index.cshtml code is:
function functionOne(streamName) {
console.log("@Url.Action("GetDataFromStream", "Index")" + "?streamName=" + encodeURIComponent(streamName));
$.ajax({
url: "@Url.Action("GetDataFromStream", "Index")" + "?streamName=" + encodeURIComponent(streamName),
success: OnSuccess,
});
}
function OnSuccess(data) {
//document.getElementById('dataTable').style.visibility = "visible";
myData = data;
$('#dataTable').kendoGrid({
dataSource: { transport: { read: { url: '@Url.Action("GetDataFromStream", "Home")', type: 'POST' } } },
scrollable: true,
toolbar: 'Metrics',
});
The grid get displayed but there is no data in it.
When I try to display myData[0][0], that displays fine.
But I want to display all the rows in data.
Thanks,
Kinnary
I am passing data to a kendoUI gird and the data doesn't display.
I'm new to this and am probably making a basic mistake.
My controller code is:
public ActionResult GetDataFromStream(string streamName)
{
string temp = OpenHttpGETConnection(streamName);
string[] split = temp.Split(new Char [] {'\r'});
//var myList = new List<dynamic>();
List<DisplayData> myList = new List<DisplayData>();
foreach (string s in split)
{
if(s!=null){
string[] strTemp = new string[2];
strTemp = s.Split(new Char[] { '\t' });
myList.Add
(new DisplayData
{
key = strTamp[0]
value = strTemp[1]
});
}
}
return Json(myList);
}
My index.cshtml code is:
function functionOne(streamName) {
console.log("@Url.Action("GetDataFromStream", "Index")" + "?streamName=" + encodeURIComponent(streamName));
$.ajax({
url: "@Url.Action("GetDataFromStream", "Index")" + "?streamName=" + encodeURIComponent(streamName),
success: OnSuccess,
});
}
function OnSuccess(data) {
//document.getElementById('dataTable').style.visibility = "visible";
myData = data;
$('#dataTable').kendoGrid({
dataSource: { transport: { read: { url: '@Url.Action("GetDataFromStream", "Home")', type: 'POST' } } },
scrollable: true,
toolbar: 'Metrics',
});
The grid get displayed but there is no data in it.
When I try to display myData[0][0], that displays fine.
But I want to display all the rows in data.
Thanks,
Kinnary