This is a migrated thread and some comments may be shown as answers.

Problem with asp.net web services consuming in kendo mobile listview

1 Answer 61 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Ashraf Syed
Top achievements
Rank 1
Ashraf Syed asked on 25 Apr 2013, 09:18 PM
Hi

I am trying to call asp.net web services in telerik kendo mobile listview  but i am not  getting any data its showing only loading on page .Please find code with attachment and with web services  .Please check what is issue in that.

And if you can share sample code from asp.net services with telerik kendo for mobile that will helpful.


//----------web services ---------------------------
 [WebMethod]
        public string   EmployeeList()
        {
            
            string abc = null;
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            SqlCommand cmd = new SqlCommand("select top 10 Firstname from employee where branchid=@branchid", connection.getConn());
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.AddWithValue("@branchid", 9);
          
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            sda.Fill(ds);
            for( int i=0;i<ds.Tables[0].Rows.Count ;i++)
            {
              
                if (i == 0)
                {
                    abc = ds.Tables[0].Rows[i]["firstname"].ToString();
                }
                else
                {
                    abc =abc+"," + ds.Tables[0].Rows[i]["firstname"].ToString();
                }
            }
            string jsonString = serializer.Serialize(abc);
            return jsonString;
        }

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 29 Apr 2013, 12:56 PM
Hello,

I posted my reply in the support ticket on the same topic. For convenience I am pasting it below:

The service will convert the result to JSON so the result will be wrapped twice. You should leave the service to serialize the data and return just a collection of objects in order to avoid the problem. We do not have examples specifically for Kendo Mobile that use page methods but I can suggest to check the ASP examples from our GitHub repository which can be found on this page. The examples use a Web Grid but the dataSource is the same so you can use the same approach.

Kind regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView (Mobile)
Asked by
Ashraf Syed
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or