I have worked based on : .Filter(filter => filter.Add(/* your filter rule */)) , that I found in here.
My code is :
var grid =
Html.Kendo().Grid<dynamic>().Name(Model.Current.Id).HtmlAttributes(new
{
// lot of stuff
}
grid.DataSource(ds =>
{
var ajaxDsBuilder = ds.Ajax();
ajaxDsBuilder.Model(model => model.Id("ID")).Events(ev => ev.Error("gridOnError")).ServerOperation(Model.Current.LazyLoading);
// mode code
var cols = Model.Current.Columns.ToList();
foreach (var col in cols)
{
ajaxDsBuilder.Sort(sort => sort.Add(col.Name).Ascending()); // this works perfect for pre-sorting ( col.Name = the column name )
ajaxDsBuilder.Group(grp => grp.Add(col.Name, typeof(string))); // this the same works great for pre-grouping
but when I try this:
ajaxDsBuilder.Filter(f => f.Add(c=> c.col.Name).IsEqualTo("TEST"));
I get : Error309 An expression tree may not contain a dynamic operation
if I try: ajaxDsBuilder.Filter(f => f.Add(c=> col.Name.ToString()).IsEqualTo("TEST")); // I am overriding ToString() to give me the name of column
I get : Internal server error
if I try: ajaxDsBuilder.Filter(f => f.Add(c=> col.Name).IsEqualTo("TEST"));
I get : Property with specified name: col.Name cannot be found on type: System.Data.DataRowView
I have also worked with lambda expressions, but I have pretty much the same errors.
My grid has to be dynamic, so I can't change that.
Any help?
Hello.
I am using the following:
Asp.net MVC 5
Ajax binding
Inline Editing
I need to pass a value to to the grid so it is populated automatically (see attached screenshot). I have google'd looked at these forums, but the following doesn't seem to populate the value in the grid.
.Read(read => read.Action("CustomerClass_Read", "CustomerClass").Data("{ CustomerId: " + @Model.CustomerId + "}"))
I know how to do this with through an Actionlink:
@Html.ActionLink("New", "Create", "ShipTo", new { CustomerId = Model.CustomerId }, new { @class = "btn btn-default btn-sm" })
Please advise.
Thanks
<
script
id
=
"sparkTemplate"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Sparkline()
.Name("temp-log_#=ID#")
.Type(SparklineType.Column)
.Tooltip(tooltip => tooltip.Format("{0} °C"))
.Data(ViewBag.TemperatureData)
.ToClientTemplate()
)
</
script
>
@(Html.Kendo().Grid<
CMS_2013.Models.CMSSummaryOne
>()
.Name("tabGrid")
.Columns(columns=>
{columns.Bound(p=>p.DivisionName).Title("Division");
columns.Bound(p => p.Specialty).Title("Specialty");
columns.Bound(p => p.Activity).Title("Activity");
columns.Bound(p => p.Plan).Title("Plan");
columns.Bound(p => p.Variance).Title("Variance").ClientTemplate("#= formatNumber(Variance) #");
columns.Bound(p => p.Variance).Title("Variance").ClientTemplate("#=sparkTemplate#");
})
.Pageable()
.Sortable()
.Selectable()
.DataSource(dataSource=>dataSource
.Ajax()
.PageSize(5)
.Read(read=>read.Action("GetTableData","Dashboard")
.Data("chartFilter")
)
)
)
Hello
I have a grid displaying workitems and the last action taken for a workitem, recently I discovered that I need to extend this to include a history of actions stored in a separate table in the db.
the two tables looks like this:
workItem
id
name
lastActionDate
lastActionText
workAction
id
workItemID
actionDate
ActionText
My model currently looks like this:
public
class
workItemModel
{
public
int
id {
get
;
set
; }
public
string
name{
get
;
set
; }
public
DateTime lastActionDate{
get
;
set
; }
public
string
lastActionText{
get
;
set
; }
}
and my read action for the grid looks like this:
public
ActionResult workItems_Read([DataSourceRequest]DataSourceRequest request)
{
return
Json(GetWorkItems().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
private
static
IEnumerable<workItemModel> GetWorkItems()
{
var wimDB =
new
wimDB_DEVEntities();
return
wimDB.workItem.Select(wiModel =>
new
workItemModel
{
id = wiModel.id,
name = wiModel.name,
lastActionDate = wiModel.lastActionDate,
lastActionText= wiModel.lastActionText
});
}
How do I extent my model and my read action to include the workAction table from the db?
/Jonas
Hi ,
We are planning to switch the project from Silverlight to MVC , So we need Telerik MVC supporting dlls .
Could you please tell me where I have to found those dlls , I have downloaded UI for ASP.net MVC from Telerik site but I could not found any MVC dll’s .
Can you please tell me from where I can get those dll’s .
Thanks
Victor
@model regDB.Models.registration
@Html.HiddenFor(model => model.id)
<
div
>
@Html.EditorFor(model => model.regionId)
</
div
>
<
div
style
=
"width: 250px;"
>
@(Html.Kendo().DropDownList()
.Name("Regions")
.HtmlAttributes(new { style = "width: 250px" })
.DataTextField("name")
.DataValueField("id")
.Value(model.regionId)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetRegions", "Home");
});
})
)
</
div
>
public JsonResult GetRegions()
{
var regDB = new regDB_DEVEntities();
regDB.Configuration.ProxyCreationEnabled = false;
return Json(regDB.region, JsonRequestBehavior.AllowGet);
}
Dear Telerik Community,
I've recognized some weird behavior of the DatePickerWidget when switching from one month to another. You can take a look at the screen shot to see exactly what I'm talking about. I don't know if this already came up to somebody of you - I hope it did so someone can help me fix it.
Kind regards,
Thomas