When the user clicks Update the cell in the grid isn't being populated with the EditorTemplate hyperlink value.
EditorTemplate:
@(Html.Kendo().Editor()
.Name("EVIDENCE")
.HtmlAttributes(new { style = "width: 250px;height:25px" })
.Tools(tools => tools.Clear().CreateLink())
.Value(@<text> </text>)
)
view:
<div class="wide-grid">
@Html.AntiForgeryToken()
@(Html.Kendo().Grid(Model.TASKs)
.Name("TasksGrid")
.Columns(columns =>
{
columns.Command(command => { command.Edit(); }).Width(50);
columns.Bound(c => c.STATUS).Visible(false);
columns.ForeignKey(c => c.RESP_ORG_ID, (System.Collections.IEnumerable)ViewData["RespOrgs"], dataFieldText: "RESP_ORG_DESC", dataFieldValue: "RESP_ORG_ID").Title("Resp Org").Width("200px");
columns.ForeignKey(c => c.ACTIVITY_ID, (System.Collections.IEnumerable)ViewData["Activities"], dataFieldText: "ACTIVITY_DESC", dataFieldValue: "ACTIVITY_ID").Title("Activity");
columns.ForeignKey(c => c.SOURCE_DOC_ID, (System.Collections.IEnumerable)ViewData["SourceDocs"], dataFieldText: "SOURCE_DOC_DESC", dataFieldValue: "SOURCE_DOC_ID").Title("Source Doc").ClientTemplate("<a href='#=SOURCE_DOC_PATH#'>#=SOURCE_DOC_DESC#</a>").Width(125);
columns.ForeignKey(c => c.ROLE_ID, (System.Collections.IEnumerable)ViewData["Roles"], dataFieldText: "ROLE_DESC", dataFieldValue: "ROLE_ID").Title("Role");
columns.Bound(c => c.RESP_ORG_ID).Visible(false);
columns.Bound(c => c.ACTIVITY_ID).Visible(false);
columns.Bound(c => c.ROLE_ID).Visible(false);
columns.Bound(c => c.DOC_REF).Width(75);
columns.Bound(c => c.DUE_DATE).EditorTemplateName("DueDate").Width(75);
columns.Bound(c => c.COMPLETED).Width(75);
columns.Bound(c => c.TASK_DESC).EditorTemplateName("TaskDescription").Width(500);
columns.Bound(c => c.EVIDENCE).EditorTemplateName("TaskEvidence").Width(15);
columns.Bound(c => c.CTL_NO);
columns.Bound(c => c.ACQUISITION_ID).Visible(false);
})
.ToolBar(toolbar => toolbar.Create().Text("Add New Task"))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Sortable()
.Filterable()
.Groupable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(15)
.ServerOperation(false)
.Events(events => events.RequestEnd("requestEnd"))
.Model(model =>
{
model.Id(a => a.TASK_ID);
})
.Update(update => update.Action("Edit", "Task").Data("sendAntiForgery"))
.Read(read => read.Action("TaskGrid_Read", "Task", new { id = @Model.ACQUISITION_ID }))
.Create(create => create.Action("Create", "Task").Data("sendAntiForgery"))
)
)
</div>
Hi,
in former WebForm projects I was using asp:DropDownList mostly in these kind of scenarios:
1) The DL was fully rendered server side and the selectable values have been populated using Object/SQL/LinqDataSource on the server.
2) The DL was two-way-bound (by the Bind or Eval statement) to a property of an arbitrary data model, e.g. in the context of a ListView or FormView.
To give you an example of the use case: Say a "status" property in a model need to have values like "On", "Off", "Unknown" and nothing else. An ObjectDataSource ensured, that the DL only contained the values for selection. Then the real model was queried in order to find the selected value and that was selected after Page_Load automatically. Once the user changed the selected value in the "status" DL, the new value was posted back to the server.
That worked fine.
I know how to achieve 1) in the "Kendo World", but I'm wondering, how I could simultaneously "two-way-bind" the DL to another model in order to set the "SelectedItem" form another data model as well as to POST finally changes made by the user.
Any pointer welcome
TIA
I have a custom template for editing a scheduler event. In that template I have a grid to edit an array that is part of my model:
@(Html.Kendo().Grid<Excent.Apps.Web.Solo.Models.MeetingStudentViewModel>(Model.Students)
.Name("StudentsGrid")
.Columns(columns =>
{
columns.Bound(m => m.MeetingStudentID).Hidden();
columns.Bound(m => m.FullName).Title("Student");
columns.Bound(m => m.Goals);
})
.BindTo(Model.Students)
.DataSource(dataSource => dataSource
.Ajax().ServerOperation(false)
.Model(model => model.Id(p => p.MeetingStudentID))
.Model(model => model.Field(o => o.FullName))
.Model(model => model.Field(o => o.Goals))
)
When I display the template the grid is empty.
When I popup a recurrence event, it does not go back to the server where I have logic that is based on the start date before current date.
How do I manipulate the Model that it creates from a recurrence event so that I can hide things based on the start date in my custom template?
in my model I have isPassed but this is based on the first in the series and not the current event..
When my page containing a grid control in MVC 5 with Bootstrap is shrunk to below 1024 px. in width, the grid paging control gets distorted as shown in the attached screenshots.
I'm using a scaffolded MVC UI (2015.3.930) grid inside a default _layout body, i.e. it is being inserted inside a div with classes "container body-content" that have not been modified.
I am using customized bootstrap themes that I generated using the Bootstrap theme builder and the Kendo UI theme builder. To the best of my knowledge, I have only altered colors in the custom themes, not anything related to padding or sizing.
Anyone else seen this problems or have suggestions how to proceed or work around this behavior?
Hi,
my treeview configuration at view:
@Html.Raw((Html.Kendo().TreeView().Name("AppellationTree").LoadOnDemand(true)
.Events(events => events
.Select("TreeView_onSelect"))
.Template("# return escapeHtml(item.Name); #")
.DataSource(d => d
.Model(m => m
.Id("Id")
.HasChildren("HasChildren")
.Children("Children")
.Field("IsAppellation", typeof(bool)))
.Read(r => r.Action("_AppellationTree", "Appellation", new { id = Model.Id })))
.DataTextField("Name")))
My _AppellationTree method:
[ActionName("_AppellationTree")]
public JsonResult GetAppellationData(int id)
{
var model = new List<TreeItemModel>();
var appellations = _appellationRepo.GetList(x => x.ParentAppellation.Id == id).OrderBy(x => x.Name);
foreach (var appellation in appellations)
{
var r = new TreeItemModel();
r.Id = appellation.Id;
r.Name = appellation.Name;
r.HasChildren = appellation.HasChildren;
model.Add(r);
}
return Json(model, JsonRequestBehavior.AllowGet);
}
I'd like to add Expand Action with javascript function and launch loading data during expanding node. How to do it? I think that should possible out of the box with three js lines like:
function onExpand(e)
{
get data (next level) from server
attache data to existing data source
fire expanding
}
Best regards
Bart
Hello
Within my editor for a scheduler I'm changing some values through an AJAX-call and apparantely this does not change the model since the update action is never fired when I press update. The update works fine if I change a model bound value. How can I manually set the model as dirty?
Do I do it in the success method for the AJAX call and how?
Basically I just need to trigger update wheter the model is changed or not.
/Jonas
I've noticed a problem with server filtering when the DropDownList is near the bottom of the page. To reproduce the problem, go to http://demos.telerik.com/aspnet-mvc/dropdownlist/serverfiltering , and shrink the browser window so that the bottom of the browser comes up to to the bottom of the box around the products dropdown. (See attached image for example.)
Click the products dropdown and notice the list is expanded above the control, which is good.
Now type "c", followed by "h". The list now moves below the control, off the page, and it can't be seen. I haven't found a way to be able to see the products in the filtered list, because if I click the scrollbar to try to scroll down the control loses focus and selects the current item, and the same happens if I try to use my mouse's scroll wheel. I am able to arrow down through the products, but it is still very awkward to not be able to see the list.
Also, this example is not a huge problem on this page, because the user could scroll the page down before entering the dropdown, and then be able to see all the contents. But in my app several pages have DropDownLists at the very bottom of the page, which makes it impossible to ever see the filtered list.
I think a good fix for this would be that if the DropDownList starts off expanded above the control, to force it to stay displaying above the control while filtering is taking place.
Hi Telerik,
I'm using NumericTextBox in ASP.NET MVC now, and I don't see it support Mouse Wheel like control for ASP.NET AJAX?
Hi,
I have a Kendo grid in which a Kendo window is opened when you click on each row. The code is:
<% Html.Kendo().Grid<EvaluationsQuestionsEvaluationVersionGridViewModel>(Model.VersionsGridModel)
.Name("Versions")
......
.Columns(columns =>
{
columns.Bound(s => s.VersionId)
.Width(180);
columns.Bound(s => s.OrganizationTypeName)
.Width(180);
...... columns.Command(commands =>
{
commands.Custom("Copy").Click("copyEvaluationVersion");
commands.Edit();
})
<% Html.Kendo().Window()
.Name("CopyVersion")
.Title()
.Content(() =>
{ %>
...... <input type="submit" value="Submit" />
<input type="hidden" id="copyEvaluationVersionId" name="copyEvaluationVersionId" value="<%= ViewData["evaluationVersionId"] %>" />
<% } %>
<%})
.Draggable(true)
......
$("#CopyEvaluationSubmit").click(function (e) {
var yearCombo = $("#copyToYear").data('kendoDropDownList');
SetRingCookie('ck_year', yearCombo.text(), { path: '/' });
return true;
});
function copyEvaluationVersion(e) {
$("#CopyVersion").data("kendoWindow").open();
$("#copyToYear").data('kendoDropDownList').read();
}
I want to know how to find the parent grid Name("Versions") in $("#CopyEvaluationSubmit").click(function (e), which is invoked when submit button is clicked in Kendo window. Thanks.