i try to return data in web method using linq .. and also i bind grid view in jquery
- $(document).ready(function () {
- BindGridView();
-
- });
- function BindGridView() {
- $.ajax({
- type: "POST",
- url: "WebForm1.aspx/search_data",
- data: JSON.stingify(obj),
- data: "{'fromdate':'" + fromdate + "','todate':'" + todate + "','regiondrop':'" + regiondrop + "','GridView1':'" + GridView1 + "'}",
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: true,
- cache: false,
- success: function (result) {
- $("#GridView1").empty();
- if (data.d.length > 0) {
- $("#GridView1").append(
- "<tr><th>Owner Name</th><th>Reg No</th></tr>");
-
- for (var i = 0; i < data.d.length; i++) {
- $("#GridView1").append("<tr><td>" +
- data.d[i].OwnerName + "</td> <td>" +
- data.d[i].RegNo + "</td> <td>" +
-
- }
- }
- }
- });
- }
webmethod
- [WebMethod]
- public static string search_data(DateTime fromdate, DateTime todate, string regiondrop)
- {
-
- try
- {
- TrackDataEntities1 ts = new TrackDataEntities1();
-
- var dq = from table
-
DataSet ds = new DataSet();
dq(ds);
return ds;
-
-
- }
- catch (Exception)
- {
- throw new Exception();
-
-
-
- }
-
- }
this show errorError 3 'dq' is a 'variable' but is used like a 'method' Error 4 Cannot implicitly convert type 'System.Data.DataSet' to 'string' so how i return this