I evaluating your component.
I need to retrive filtered data with custom filter into custom header with refresh button click
Client:
.Pageable(p => p.Refresh(true))
.Sortable()
.Selectable()
.Scrollable(scrollable => scrollable.Height(30))
.Filterable()
.HtmlAttributes(new { style = "height:550px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Model(model => model.Id(p => p.Id))
.ServerOperation(true)
.Read(create => create.Action("IncomingRead", "Grid", new { topRow = ""}))
)
Server:
public ActionResult IncomingRead([DataSourceRequest]DataSourceRequest request)
{
string virtualPath = "";
var customerWhereCondition = "";
var userIdWhereCondition = "";
var versionNumberWhereCondition = "";
var json = Helper.GetDataFromDb(virtualPath, 100, "-1", customerWhereCondition,
userIdWhereCondition, versionNumberWhereCondition, new DateTime(2015, 4, 1), DateTime.Now);
return Json(json.ToDataSourceResult(request));
}
how to set filter into request object(client) and get filter into the server for execute new query?
thankyou in advance.
Regards,
Flavio
I want to have a MultiSelect with a default value (the name of the current user), but I also do not want to bind the data as there are far too many users to load at once.
How can I have both? Currently, the default value overrides the pre-select value.
http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/multiselect/overview#pre-select-values-on-initial-loading​
Hi, I'm in the middle of evaluating if I'm going to switch to Telerick (currently using DevExpress) and one of the control that is critical to my project is (what they call) the GridLookup. Essentially it's a combox which the user pulls down, showing a grid from which rows can be (multi)selected http://demos.devexpress.com/MVCxGridViewDemos/GridLookup/MultiSelect
It needs to be available for MVC (not ajax) and needs to be able to bind to SignalR. I don't know if that matters but I'm using VS 2013, ASP.NET (MVC), C#.
I've played around with the multi-select and a custom multi-columns combobox but they lack the grid's extra capabilities (such as grouping, filtering, sorting, etc..).
Any chance I can get to the same result (or close) using Telerik's component(s)?
Thank you :)
I cant seem to find where I am going wrong with this, i'm not seeing any javascript errors.
My update action is not being called. I notice that the Update button of the grid row takes 4-5 seconds to return to an edit. This grid is loaded via jquery load into a div.
Here is the grids cshtml:
@model PathologyScheduling.Models.TaskScheduleViewModel
@using PathologyScheduling.Models;
@( Html.Kendo().Grid<PathologyScheduling.Models.TaskScheduleViewModelRecord>(Model.Records)
.Name("TaskScheduleGrid")
.Editable(editable =>
{
editable.Mode(GridEditMode.InLine);
})
.ToolBar(tools => tools.Pdf())
//.Scrollable()//scrolling => scrolling.Enabled(true).Virtual(false))
.Resizable(r => r.Columns(true))
.ColumnResizeHandleWidth(10)
.HtmlAttributes(new { style = " width: 100%" })
.Pdf(pdf => pdf
.AllPages().Landscape()
.FileName("TaskSchedule_" + @Model.SelectedScheduleId + ".pdf")
.ProxyURL(Url.Action("Pdf_Export_Save", "Home")))
.Columns(x =>
{
x.Command(item => item.Edit());
x.Bound(item => item.Date).Format(@"{0:ddd (dd)}")
.Title("Date").Locked(true);
x.Bound(item => item.Value)
.Title("FTE");
x.Bound(item => item.SingleDay)
.ClientTemplate("#= renderMultiSelect(data.SingleDay) #")
.EditorTemplateName("StaffListSingleDay")
.Title(TaskScheduleViewModelRecord.Constants.SingleDay);
x.Bound(item => item.HalfDay)
.ClientTemplate("#= renderMultiSelect(data.HalfDay) #")
.EditorTemplateName("StaffListHalfDay")
.Title(TaskScheduleViewModelRecord.Constants.HalfDay);
x.Bound(item => item.Gross)
.ClientTemplate("#= renderMultiSelect(data.Gross) #")
.EditorTemplateName("StaffListGross")
.Title(TaskScheduleViewModelRecord.Constants.Gross);
x.Bound(item => item.LightMicroscopy)
.ClientTemplate("#= renderMultiSelect(data.LightMicroscopy) #")
.EditorTemplateName("StaffListLightMicroscopy")
.Title(TaskScheduleViewModelRecord.Constants.LightMicroscopy);
x.Bound(item => item.Pool2X)
.ClientTemplate("#= renderMultiSelect(data.Pool2X) #")
.EditorTemplateName("StaffListPool2X")
.Title(TaskScheduleViewModelRecord.Constants.Pool2X);
x.Bound(item => item.Pool15X)
.ClientTemplate("#= renderMultiSelect(data.Pool15X) #")
.EditorTemplateName("StaffListPool15X")
.Title(TaskScheduleViewModelRecord.Constants.Pool15X);
x.Bound(item => item.Pool1X)
.ClientTemplate("#= renderMultiSelect(data.Pool1X) #")
.EditorTemplateName("StaffListPool1X")
.Title(TaskScheduleViewModelRecord.Constants.Pool1X);
x.Bound(item => item.Pool075X)
.ClientTemplate("#= renderMultiSelect(data.Pool075X) #")
.EditorTemplateName("StaffListPool075X")
.Title(TaskScheduleViewModelRecord.Constants.Pool075X);
x.Bound(item => item.Pool05X)
.ClientTemplate("#= renderMultiSelect(data.Pool05X) #")
.EditorTemplateName("StaffListPool05X")
.Title(TaskScheduleViewModelRecord.Constants.Pool05X);
x.Bound(item => item.Pool025X)
.ClientTemplate("#= renderMultiSelect(data.Pool025X) #")
.EditorTemplateName("StaffListPool025X")
.Title(TaskScheduleViewModelRecord.Constants.Pool025X);
x.Bound(item => item.Gyne1X)
.ClientTemplate("#= renderMultiSelect(data.Gyne1X) #")
.EditorTemplateName("StaffListGyne1X")
.Title(TaskScheduleViewModelRecord.Constants.Gyne1X);
x.Bound(item => item.Gyne05X)
.ClientTemplate("#= renderMultiSelect(data.Gyne05X) #")
.EditorTemplateName("StaffListGyne05X")
.Title(TaskScheduleViewModelRecord.Constants.Gyne05X);
x.Bound(item => item.Gyne025X)
.ClientTemplate("#= renderMultiSelect(data.Gyne025X) #")
.EditorTemplateName("StaffListGyne025X")
.Title(TaskScheduleViewModelRecord.Constants.Gyne025X);
x.Bound(item => item.NonG)
.ClientTemplate("#= renderMultiSelect(data.NonG) #")
.EditorTemplateName("StaffListNonG")
.Title(TaskScheduleViewModelRecord.Constants.NonG);
x.Bound(item => item.HEM)
.ClientTemplate("#= renderMultiSelect(data.HEM) #")
.EditorTemplateName("StaffListHEM")
.Title(TaskScheduleViewModelRecord.Constants.HEM);
x.Bound(item => item.Sturgeon)
.ClientTemplate("#= renderMultiSelect(data.Sturgeon) #")
.EditorTemplateName("StaffListSturgeon")
.Title(TaskScheduleViewModelRecord.Constants.Sturgeon);
x.Bound(item => item.Biochemistry)
.ClientTemplate("#= renderMultiSelect(data.Biochemistry) #")
.EditorTemplateName("StaffListBiochemistry")
.Title(TaskScheduleViewModelRecord.Constants.Biochemistry);
x.Bound(item => item.Dermpath)
.ClientTemplate("#= renderMultiSelect(data.Dermpath) #")
.EditorTemplateName("StaffListDermpath")
.Title(TaskScheduleViewModelRecord.Constants.Dermpath);
x.Bound(item => item.Colpos)
.ClientTemplate("#= renderMultiSelect(data.Colpos) #")
.EditorTemplateName("StaffListColpos")
.Title(TaskScheduleViewModelRecord.Constants.Colpos);
x.Bound(item => item.Liver)
.ClientTemplate("#= renderMultiSelect(data.Liver) #")
.EditorTemplateName("StaffListLiver")
.Title(TaskScheduleViewModelRecord.Constants.Liver);
x.Bound(item => item.QACytology)
.ClientTemplate("#= renderMultiSelect(data.QACytology) #")
.EditorTemplateName("StaffListQACytology")
.Title(TaskScheduleViewModelRecord.Constants.QACytology);
x.Bound(item => item.QAHistology)
.ClientTemplate("#= renderMultiSelect(data.QAHistology) #")
.EditorTemplateName("StaffListQAHistology")
.Title(TaskScheduleViewModelRecord.Constants.QAHistology);
x.Bound(item => item.ResidencyTraining)
.ClientTemplate("#= renderMultiSelect(data.ResidencyTraining) #")
.EditorTemplateName("StaffListResidencyTraining")
.Title(TaskScheduleViewModelRecord.Constants.ResidencyTraining);
})
.Selectable()
.DataSource(dataSource => dataSource
.Ajax()
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.Id);
model.Field(p => p.Date).Editable(false);
model.Field(p => p.Value).Editable(false);
model.Field(p => p.SingleDay).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.HalfDay).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Gross).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.LightMicroscopy).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Pool2X).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Pool15X).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Pool1X).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Pool075X).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Pool05X).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Pool025X).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Gyne1X).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Gyne05X).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Gyne025X).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.NonG).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.HEM).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Sturgeon).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Biochemistry).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Dermpath).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Colpos).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.Liver).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.QACytology).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.QAHistology).Editable(true).DefaultValue(new List<SelectListItem>());
model.Field(p => p.ResidencyTraining).Editable(true).DefaultValue(new List<SelectListItem>());
})
.Update(update => update.Action("UpdateTaskSchedule", "Home").Type(HttpVerbs.Post))
.Read(read => read.Action("TaskSchedule", "Home", @Model.SelectedScheduleId))
)
)
<script>
function renderMultiSelect(selectListArray) {
if (selectListArray != undefined && selectListArray[0] != undefined) {
var displayText;
$.each(selectListArray, function (index) {
if (displayText == undefined) {
displayText = selectListArray[index].Text + ', ';
}
else {
displayText = displayText + selectListArray[index].Text + ', ';
}
});
return displayText.slice(0, -2);
}
else {
return "";
}
}
function TaskScheduleRefreshGrid(e) {
debugger;
var grid = $("#TaskScheduleGrid").data("kendoGrid");
grid.dataSource.read({ "id": $("#TaskScheduleIdSelector").val() });
}
</script>
I have an editor template for most of the columns which is the same for most of the records:
@model List<SelectListItem>
@(Html.Kendo().MultiSelectFor(x=>@Model)
.Name("StaffListBiochemistry")
.BindTo((System.Collections.IEnumerable)ViewData["Staff"])
.DataTextField("Text")
.DataValueField("Value")
)
Hi,
I have to render my partial view in html string (in controller), to return json object.
I found this function that works very well :
01.
public
static
String RenderViewToString(ControllerContext context, String viewPath,
object
model =
null
)
02.
{
03.
context.Controller.ViewData.Model = model;
04.
using
(var sw =
new
StringWriter())
05.
{
06.
//var viewResult = ViewEngines.Engines.FindView(context, viewPath, null);
07.
var viewResult = ViewEngines.Engines.FindPartialView(context, viewPath);
08.
var viewContext =
new
ViewContext(context, viewResult.View, context.Controller.ViewData, context.Controller.TempData, sw);
09.
viewResult.View.Render(viewContext, sw);
10.
viewResult.ViewEngine.ReleaseView(context, viewResult.View);
11.
return
sw.GetStringBuilder().ToString();
12.
}
13.
}
With a kendo grid in partial view, i'm getting a "System.NullReferenceException" on the declaration @(Html.Kendo().Grid(.....
If I return the view with a "Return view" in my controller, it's ok.
My grid:
01.
@(Html.Kendo().Grid((IEnumerable<MAGI.Model.DigicodeImmeuble>)mvDigicode)
02.
.Name(
"gridSyntheseDigicode"
)
03.
.HtmlAttributes(
new
{ style =
"width:100%;height: auto;"
, @
class
=
"k-grid_encart k-grid_nopage"
})
04.
.Columns(t =>
05.
{
06.
t.Bound(c => c.Digicode1.Nom).Title(tabTraduction[701972] +
" 1"
);
07.
t.Bound(c => c.Digicode1.NoDigicode).Title(tabTraduction[100620]);
08.
t.Bound(c => c.Digicode2.Nom).Title(tabTraduction[701972] +
" 2"
);
09.
t.Bound(c => c.Digicode2.NoDigicode).Title(tabTraduction[100620]);
10.
}
11.
)
12.
.Sortable()
13.
.Selectable()
14.
.DataSource(dataSource => dataSource
15.
.Ajax()
16.
.ServerOperation(
false
)
17.
)
18.
.Reorderable(reorder => reorder.Columns(
true
))
19.
.Events(events => events.DataBound(
"onDataBoundGridStandard"
))
20.
)
mvDigicode and tabTraduction are not null.
That's work with the kendo chart module.
What's wrong with the grid ?
Many thanks,
Hi,
We are using a detail row on one of our grids, but have noticed that there are a couple of issues with the way we have done it and I am wondering if there is a way to do the following:
1. When we re-order the columns on the main grid, re-order the same columns on the detail row.
2. When we re-size the columns on the main grid, re-size them on the detail row.
The problem is that we have hard coded the order currently, but are allowing the user the ability to re-order, thus presenting us with the issues above.
Is there an easy way of achieving the above, or will it be a case of manually manipulating them both with javascript?
Cheers,
Gareth
Is there are document that maps the MVC Razor syntax to the raw Kendo UI notation?
I find several examples using Kendo UI that suit my needs but I need to convert them to run in an MVC project.
It's not always clear how the syntax matches from one to the other.
Thanks,
Ken
Hello, I am unable to get data into my kendo grid. I have looked at many other threads but nothing has helped so far. I want to get the data from my controller / model but I am not sure if i am trying to do it correctly
VIEW
@model MyProject.Models.POApprovalViewModel
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
ViewBag.Title = "PO Approval";
}
<
div
class
=
"container"
>
<
h4
>PO Approval</
h4
>
@(Html.Kendo().Grid(Model.AssignedApprovals)
.Name("grdPOs")
.Columns(columns =>
{
columns.Bound(model => model.PoId);
columns.Bound(model => model.PoStatus);
})
.Pageable()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(true)
.Model(model => model.Id("PoId"))
.Read(read => read.Action("POApproval_Read", "POApproval"))
)
)
</
div
>
CONTROLLER
public class POApprovalController : Controller
{
string UserId;
POApprovalViewModel po;
// GET: POApproval
public ActionResult Index()
{
po = new POApprovalViewModel();
return View(po);
}
[HttpPost]
public ActionResult POApproval_Read()
{
dbPOApproval db = new dbPOApproval();
return Json(db.GetAssignedApprovals());
}
}
MODEL
public class POApprovalViewModel
{
public List<
OLAssignedApprovals
> AssignedApprovals
{
get
{
if (_AssignedApprovals == null)
{
_AssignedApprovals = new List<
OLAssignedApprovals
>();
}
return _AssignedApprovals;
}
}
private List<
OLAssignedApprovals
> _AssignedApprovals;
}
public class OLAssignedApprovals
{
public int PoId { get; set; }
public string PoStatus { get; set; }
}
public class dbPOApproval
{
MyDataSourceOjbect objPOApproval = new MyDataSourceOjbect();
public List<
Models.OLAssignedApprovals
> GetAssignedApprovals()
{
List<
Models.OLAssignedApprovals
> lPoApproval = new List<
Models.OLAssignedApprovals
>();
Models.OLAssignedApprovals li = new Models.OLAssignedApprovals();
DataSet ds = objPOApproval.GetPOApprovals();
foreach (DataRow dr in ds.Tables[0].Rows)
{
li = new Models.OLAssignedApprovals();
li.PoId = Convert.ToInt32(dr["POID"]);
li.PoStatus = dr["POStatus"].ToString();
lPoApproval.Add(li);
}
return lPoApproval;
}
}