Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
View:
@( Html.Kendo().MobileListView()
                          .Name("flat-listview")
                          .PullToRefresh(true)
                          .AutoBind(true)
                        //  .EndlessScroll(true)
                          .HtmlAttributes(new { @style = "background-color:#e4f0f8"})
                          .HeaderTemplateId("customListViewHeaderTemplate")
                          .TemplateId("template")
                          .DataSource(dataSource =>
                                         dataSource
                          .Read("FlatData", "TTSCancel"))
                          .Filterable(filter =>
                          filter.Field("strFilter")
                          .Operator("contains")
                          )
                          .Events(events => events.Click("onClick").DataBound("onDataBound"))
                          )
JS:
function onClick(e) {
        //alert(e.item[0].outerText)
        var SelectedVal = e.item[0].outerText;

        var urlsearch = "@Url.Content("~/TTSCancel/View2")";
        alert(urlsearch)
        $.ajax({
            url: urlsearch,
            dataType: "json",
            type: "POST",
            //contentType: 'application/json; charset=utf-8',
            data: { GetSelectedVal: SelectedVal },

            success: function (result) {
                alert(result.url)
                window.location = result.url;
            }
        });
    }

Controller:
[AcceptVerbs(HttpVerbs.Post)]
        public ActionResult FlatData([DataSourceRequest] DataSourceRequest request)
        {
            return Json(flipbutton_Read().ToDataSourceResult(request));
        }
All the things i have done but the issue is page not redirected... tell me a solution

Controller:
[HttpPost]
        public ActionResult View2([DataSourceRequest]DataSourceRequest request, string GetSelectedVal)
        {
            IList<string> split1;
            split1 = GetSelectedVal.Split(new[] { '\n' });
            ViewBag.Code = split1[0];
            ViewBag.Desc = split1[2];
            //return View();
            return Json((GetSelectedVal).ToDataSourceResult(request));
        }	
View2:
<h3>Code :</h3>
<label class="labelclass">@ViewBag.Code</label>
<h3>Decsription :</h3>
<label class="labelclass">@ViewBag.Desc</label>
Posted
Updated 21-Jan-16 20:08pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900