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(
- "
Owner Name Reg No "); -
- for (var i = 0; i < data.d.length; 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");
-
- }
-
- }
this show error
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
11 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Soumalya DasPosted Aug 7, 2016, 12:06 PM
scropio gurlPosted Jul 15, 2016, 6:01 AM
Manas MohapatraPosted Jul 15, 2016, 5:40 AM
scropio gurlPosted Jul 15, 2016, 4:18 AM
scropio gurlPosted Jul 15, 2016, 3:33 AM
@Manas Mohapatra
Manas MohapatraPosted Jul 15, 2016, 3:29 AM
scropio gurlPosted Jul 15, 2016, 3:16 AM
Bikesh SrivastavaPosted Jul 15, 2016, 3:05 AM
Vinay SinghPosted Jul 15, 2016, 3:05 AM
scropio gurlPosted Jul 15, 2016, 3:00 AM
Bikesh SrivastavaPosted Jul 15, 2016, 2:56 AM