This question is locked. New answers and comments are not allowed.
I have Textbox, search button and MVC telerik Grid on a page. On Click on button the button, I am getting textbox value in My ActionMethod and based on this textbox value, I am feting the records and displaying in Grid. But as I am try to sort, or click on paging link it, It gives to call to Ajax method which again resetting the Grid values and loosing the previous values. Could anybody please let me know how to maintain the state of textbox and grid as well?
Please find the code below.
View Code:
Please find the code below.
View Code:
@ using (Html.BeginForm("Index", "Home")) { @Html.TextBox("txtStudentName") <button class="t-button" name="buttonName" type="submit" value="search">Search</button> } @( Html.Telerik().Grid(Model) .Name("Grid") .Pageable(paging => paging .PageSize(10) .Style( GridPagerStyles .NextPreviousAndNumeric) .Position( GridPagerPosition.Bottom)) Sortable(sorting => sorting .SortMode(GridSortMode.SingleColumn)) .Filterable(filtering => filtering.Enabled(true)) .Scrollable(scrollable => scrollable.Enabled(true)) .Selectable() .Columns(columns => { columns.Bound(o => o.StudentID).Title("ID"); columns.Bound(o => o.StudentName).Title("Name"); }) .DataBinding(dataBinding => { dataBinding.Ajax().Select("_AjaxBinding", "Home");
}) ) Controller Code public ActionResult Index(string txtStudentName) { Based on txtStudentName, I am fetching the records or setting initially to default values. }
[GridAction] public ActionResult _AjaxBinding( ) { return View(new GridModel....... }
How to solve this problem. Please Help.