i try to return data in web method using linq .. and also i bind grid view in jquery
JavaScript
$(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(
"Owner NameReg No");
for (var i = 0; i
$("#GridView1").append("" +
data.d[i].OwnerName + " " +
data.d[i].RegNo + " " +
}
}
}
});
}webmethod
- [WebMethod]
- public static string search_data(DateTime fromdate, DateTime todate, string regiondrop)
- {
- try
- {
- TrackDataEntities1 ts = new TrackDataEntities1();
- var dq = from table //here is LINQ query which is long so i did not paste ..... .ToList();
- DataSet ds = new DataSet();dq(ds);return ds;
- }
- catch (Exception)
- {
- throw new Exception();
- // GridView1.Visible = false;
- // Label4.Text = ("No Data");
- }
- }
Error 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

Bikesh SrivastavaRank #108 · 20.3K reputationPosted Jul 14, 2016, 10:56 PM EDT
scropio gurl145 reputationPosted Jul 14, 2016, 11:00 PM EDT
Vinay SinghRank #604 · 4K reputationPosted Jul 14, 2016, 11:05 PM EDT
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Jul 14, 2016, 11:05 PM EDT
scropio gurl145 reputationPosted Jul 14, 2016, 11:16 PM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Jul 14, 2016, 11:29 PM EDT
scropio gurl145 reputationPosted Jul 14, 2016, 11:33 PM EDT
@Manas Mohapatra
scropio gurl145 reputationPosted Jul 15, 2016, 12:18 AM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Jul 15, 2016, 1:40 AM EDT
scropio gurl145 reputationPosted Jul 15, 2016, 2:01 AM EDT
Soumalya DasRank #2,515 · 558 reputationPosted Aug 7, 2016, 8:06 AM EDT