Hi All,
I am trying to call a webservice method on a ASP.NET page (in AJAX enabled website). I have my asmx file in the same project as my ASP.NET page. When i try to compile the project , i am getting a "Could not create type TestService" error. Can some body tell me what exactly is the problem here?
Thanks
Mahesh
cud u have given namespace reference of web.script.services.scriptservices
as using web.script.services.scriptservices
& inherite [ScriptServices]
Thanks for the reply ranjeet. But i don't really get the gist of your message , can you please be more clear? I am copying my webservice code below for your reference:
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Data.SqlClient;
using System.Data;///<summary>
/// Summary description for TestService
///</summary>///
namespace MyTestService{
[WebService(Namespace ="http://tempuri.org/")]
[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]
publicclassTestService : System.Web.Services.WebService
{
[WebMethod][ScriptMethod]
publicDataSet GetEmployeeDetails(int empID){
String strConnectionString =String.Empty;String strQuery ="Select * from Employee where EmployeeID = " + empID; ;
strConnectionString ="Server=PC21172\\SQLEXPRESS;Database=EmployeeDB;user=sa;pwd=pwd";//Get the employee details for the passed id
SqlConnection c =newSqlConnection(strConnectionString);c.Open();
SqlDataAdapter dataAdapter =newSqlDataAdapter(strQuery, strConnectionString);DataSet dsEmployeeDetails =newDataSet();dataAdapter.Fill(dsEmployeeDetails);
return dsEmployeeDetails;}
}
}
Thanks
Mahesh
The DataSet and DataTable is supported in the v1.0. You have add the preview version.
Hi,
I have infact downloaded the January CTP and i am able to return the datatable. Now th issue is , how can i bind the datatable or dataset that i return from the webservice to a ASP.NET datagrid control in javascript call back function. Can somebody help me on this?
Thanks
Mahesh
The Asp.net DataGrid/GridView does not have any objectmodel in the client side. Few days back I wrote a component which does the exact thing, Checkout the following article:http://dotnetslackers.com/articles/ajax/ASPNETAjaxGridAndPager.aspx
No comments:
Post a Comment