Here is the scenario.
I have an Index page with a Grid. The Grid's popup displays another Grid. And I'm using Inline editing in this popup grid. I'm trying to bind a column to a . When trying to bind it using the ClientTemplate grid in Inline edit mode the editor doesn't appear. Instead, the page breaks and displays on the Index page itself. If I comment the ClientTemplate line, everything works fine.
Is it possible to display a in an InLine editing of a Popup Grid?
Below is the relevant code snippets from my project.
Index.html - this page has a grid containing a list of records and I used a popup for editing data. This uses MembersEditorTemplate.cshtml for editing data.
@(Html.Kendo().Grid<Aamva.Api.Common.WebSite.Models.WebUser>() .Name("membersGrid") .Columns(columns => { columns.Command(command => { command.Edit(); command.Destroy().Text("DeleteCustomer"); }).Width("15%"); columns.Bound(p => p.FullName); columns.Bound(p => p.Role); columns.Bound(p => p.Title); columns.Bound(p => p.EmailAddress); }) .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("MembersEditorTemplate").Window(w => w.Title("Edit Employee"))) .Filterable(ftb => ftb.Mode(GridFilterMode.Row)) .DataSource(dataSource => dataSource .Ajax() .PageSize(10) .Model(model => model.Id(p => p.KEY)) .Read(read => read.Action("ListMembers", "Home")) .Destroy(destroy => destroy.Action("DeleteCustomer", "Home")) .Update(update => update.Action("PopupUpdate", "Home")) ) ) )
MembersEditorTemplate.cshtml - this editor template again contains a grid and the editing in this grid is InLine
This grid has a column that displays AddressTypeName
For this, I used ClientTemplate and referred the Object type UserAddressType.AddressTypeName
If I comment the ClientTemplate line, everything works fine.
<div class="row" style="margin-left:10px;"> @(Html.Kendo().Grid<Models.WebUserAddress>() .Name("addressGrid") .Columns(columns => { columns.Command(command => { command.Edit(); command.Destroy(); }).Width("15%"); columns.Bound(model => model.UserAddressType).ClientTemplate("#= UserAddressType.AddressTypeName #"); columns.Bound(p => p.AddressLine1); columns.Bound(p => p.AddressLine2); columns.Bound(p => p.City)); columns.Bound(p => p.State); columns.Bound(p => p.Country); }) .DataSource(dataSource => dataSource .Ajax() .PageSize(10) .Events(events => events.Error("error_handler")) .Model(model => model.Id(p => p.CustomerAddressKey)) .Read(read => read.Action("ListAddresses", "Home").Data("getCurrentCstKey")) .Destroy(destroy => destroy.Action("DeleteAddress", "Home")) .Update(update => update.Action("UpdateAddress", "Home")) .Create(create => create.Action("AddAddress", "Home")) ) .ToolBar(toolBar => { toolBar.Create(); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) )</div>AddressTypeEditor.
This has a DropDownList that refers to all the available Address Types.
@model Models.WebUserAddressType@(Html.Kendo().DropDownList() .Name("UserAddressType") .DataTextField("AddressTypeName") .DataValueField("AddressTypeKey") .DataSource(d => d .Read("GetAllAddressTypes", "Home") ))
ViewModels are as below
Used UIHint as AddressTypeEditor
public class WebUserAddress{ [UIHint("AddressTypeEditor")] public WebUserAddressType UserAddressType { get; set; } public string AddressLine1 { get; set; } public string AddressLine2 { get; set; } public string City { get; set; } public string State { get; set; } public string Country { get; set; }}public class WebUserAddressType{ public string AddressTypeKey { get; set; } public string AddressTypeName { get; set; }}
Is it possible to display a in an InLine editing of a Grid(Grid that is inside a Popup)?
Hello,
We would like to use Telerik for our applications but need to read a good documentations how to start to create in chtml, we are using Razor for right now. How to convert from Razor to Kento like dropdownlist using model and ajax?
Thank you!

Good morning,
I've currently got an issue with fixed column widths not being respected when I use grouping. I can see that the grid table has a table-layout value of fixed and understand from the docs why the behaviour I'm seeing is happening. When a table has a layout value of fixed, the column gets its width from the first row in the table. When grouping is enabled, the first row contains a td which spans the whole row and therefore there is no fixed width to apply to the column.
Please see this Fiddle which demonstrates my issue.
The first table allows fixed column widths as expected.
The second table has a first row spanning all columns (as per a grid with grouping enabled) and disregards the column width.
The third table is the only way I've been able to resolve the issue so far, by adding a row above the row containing the spanned column and removing all spacing in order to 'hide' it.
Could you please advise whether there is any other way to resolve this issue? If not, could this functionality (i.e. adding a 'hidden' column) possibly be added to the Grid?
Many thanks for your assistance.
Antony
01.public enum MyEnum02.{03. UsefulUiValue1, //Useful for filtering in the grid04. UsefulUiValue2, //Useful for filtering in the grid05. UsefulUiValue3, //Useful for filtering in the grid06. Value4, //Not useful for filtering in the grid (should be excluded from dropdown filter)07. Value5, //Not useful for filtering in the grid (should be excluded from dropdown filter)08.}09. 10.public class MyClass11.{12. public MyEnum OrderStatus { get; set; }13. public DateTime OrderDate { get; set; }14. public decimal OrderSum { get; set; }15.}
I'm trying to enable grouping by a foreign key column. However, a default Ajax setup will display the id of the column, not the display text for the group header. With server binding, the group header displays as expected. With Ajax binding however, it won't.
Using Kendo 2012.2.607. I know this used to work with Telerik, used it all the time.
@(Html.Kendo().Grid(Model.Users)
.Name("Users")
.DataSource(c => c.Ajax()
.Read("_Roles", "Users")
.Group(g => g.Add(o => o.RoleId)))
.Columns(c => {
c.Bound(o => o.UserName);
c.ForeignKey(o => o.RoleId, Model.Roles);
c.Bound(o => o.IsActive);
})
.Sortable()
.Filterable()
.Groupable()
.Pageable())
With this, the group headers will read as "Role: 1", "Role: 2" and so on. Expected "Role: Admin", "Role: User", etc. Can't really find any options to fix this. Trying to add a ClientGroupHeaderTemplate doesn't work either - always yields an error about whatever value being undefined. The anonymous function called to display the template has no real data to display the correct label.
c.ForeignKey(o => o.RoleId, Model.Roles)
.ClientGroupHeaderTemplate("#= Title #");
Edit - I setup a jsfiddle here to illustrate.
Hello,
I'm presently using asp.net core Kendo DateTimePicker control -
@(Html.Kendo().DateTimePickerFor(m => m.DateTime)
.HtmlAttributes(new { style = "width:300px;", id = "DateTime" })
.Value(Model.DateTime)
)
Also, I have a hidden variable in the form,
<input type="hidden" asp-for="DateTime" />
The problem here is it displays two controls, it gets and sets the data in the right way! Would appreciate any help! Thanks in advance!
Hi,
I am working on the scatter chart where the data should be plotted time(example:12:45:12) vs weekday(Monday).Where X-axis is Weekdays from Monday to Friday and Time is y-axis 9:00 am to 4:00 pm with Interval of 1 hour. I did not found any examples on this unable to achieve this.
Below is the sample code Kindly help me in this regard.
Thanks & Regards,
Sampath
<div class="roundbox" style="width:450px; height:350px; border: solid 5px steelblue; float:right; margin-top:10px; margin-bottom:20px">
@(Html.Kendo().Chart<AdvantEdgePortal.Web.ViewModels.DayTimeStamp>()
.Name("chartcallTimings")
.Title("Call Timings")
.DataSource(dataSource => dataSource.Read(
read => read.Action("GetCallDataCompletionTime", "Home"))
)
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.SeriesDefaults(seriesDefaults => seriesDefaults
.Scatter().Labels(labels => labels
.Visible(false)
)
)
.Series(series =>
{
series.Scatter(m => m.WeekDay, m => m.TimeofDay);
//series: [{ type: "scatterLine", name: "3.1C", data: [[10, 70], [13, 90], [25, 100]], dashType: "dot" }]
}
)
.CategoryAxis(axis => axis
.Categories("Monday", "Tuesday", "Wednesday", "Thrusday", "Friday")
.MajorGridLines(lines => lines.Visible(false))
.Categories(c => c.WeekDay)
)
.ValueAxis(axis => axis
.Numeric()
.MajorUnit(1)
.Min(9)
.Max(16)
.Labels(labels => labels.Format("{0:N0}:00"))
.Line(line => line.Visible(true))
)
.ChartArea(chartArea =>
{
chartArea.Height(340);
chartArea.Width(440);
chartArea.Margin(5);
})
)
</div>
Hello.
I'm using kendoValidator to display all my validation errors with the kendo validation template. Using this:
<script> $(function () { $("form").kendoValidator();});</script>
But I have certain errors that I handle server side in the controller. Because they are kind of complex. And then I added the errors to the model this way:
ModelState.AddModelError("Hours", "The hours and the minutes can't be both 0.");
But if I add an error this way it is displayed with the standard ASP NET MVC way:
<span class="field-validation-error text-danger" data-valmsg-for="Hours" data-valmsg-replace="true">The hours and the minutes can't be both 0</span>
¿Is some kind of way to display those errors like the kendoValidator way?
In the image attached I show one error client side like kendo validation and two error's server side. I would like to all of then be like the client side error.
Thank you.
Hello.
I am using Export to Excel functionality.
Is there a way of adding page numbers to the excel generated from the grid?
I have tried the following but it does not work.
function excelExport(e) {
var sheet = e.workbook.sheets[0];
sheet.pageNumber = true;
}
Or is there any property which can be set when defining the Excel?
.Excel(excel => excel
.FileName("Users.xlsx")
.Filterable(true)
.ProxyURL(Url.Action("Excel_Export_Save", "UserAndGroup"))
)
Thanks
I have a Grid with a mix of static and dynamic columns. The static columns have a lot going on -- the user can choose groups of columns to display. There's formatting, commands, etc. I retrieve the main list of models from the database based on some filter criteria from the user. Based on the user selection for displayed columns, I augment the data returned with additional data and fill out more data on the models.
However, the tricky part is that users can customize additional fields they want to see in this table. These fields are dynamic. Our application is for building forms, so they define their own fields. Let's say a customer defines 200 fields they want to have on their form. Of those 200 fields, they wish to display 4 of them in the grid I'm struggling with. These fields are stored in a table "flat",so like:
CustomerID FieldID FieldName
1 1 "age"
The answers to these are stored like:
FieldID UserID Value:
1 1 25
I retrieve the data for these dynamic fields with a combination of Linq and SQL. I pivot the data, so get:
UserID 1 3 4 6
1 25 "foo" "bar" 3/4/2010
Currently, I'm taking these results and I'm adding it to a Dictionary<> per Model. Then I dynamically add them to my Kendo MVC grid:
foreach (var key in Model.AdminColumns.Keys)
{
c.Template(@<text>@item. </text>).ClientTemplate(String.Format("#=CustomFields['{0}']#", key.ToUpper())).HeaderTemplate(Model.AdminColumns[key]);
}
})
I can display the data just fine. However, I really need to add sorting and filtering to these columns. I understand that's not supported the way I'm doing it. The problem is, I can't seem to find a solution that will give me what I need. I can't change the nature of the data obviously. But, I'm willing to take a new approach. However, I keep running into road blocks. I tried using the dynamic keyword and building a model, but the grid helper didn't like that. I was thinking of going down the path of returning a json model with the dynamic fields merged in as first class members of each dataitem, but then i'm not sure how to define the grid.
Do you have any suggestions? My complete grid code is shown below.
@(Html.Kendo().Grid(Model.Donors).Name("DonorGrid") .DataSource(ds => ds.Ajax() .ServerOperation(false) .Model(m => m.Id(x => x.DonorId)) .Read(r => r .Action("GetDonors", "Donor") .Type(HttpVerbs.Post) .Data("getAdditionalData")) .PageSize(Model.RowsPerPage) ) //.ToolBar(t => t.Excel()) .Excel(e => e.FileName("DonorsExport.xlsx")) .Columns(c => { c.Group(g => g.Title(" ").CenterGroupHeader() .Columns(cm => { //cm.Select().Width(30); cm.Bound(m => m.DonorId).ClientTemplate("<a href=\"/App/Donor.aspx/EditDonor?donorId=#=DonorId# \">Edit</a>").HeaderTemplate("Edit").Width(75).Filterable(false).Sortable(false).Locked(true).CenterCell(); cm.Bound(m => m.AdminThumbnail).ClientTemplate("<img src=\"#=AdminThumbnail#\" width=50px;").HeaderTemplate("").Visible(Model.Columns.Thumbnail).Width(75).Filterable(false).Sortable(false).Locked(true).CenterCell(); cm.Bound(m => m.Email).Visible(Model.Columns.Email); cm.Bound(m => m.Unsubscribed).ClientTemplate("#if(Unsubscribed){# <span class='red glyphicon glyphicon-flag'></span> #}#").Visible(Model.Columns.Email).Width(80).CenterCell(); })); c.Group(g => g.Title("Current Status").CenterGroupHeader() .Columns(cs => { cs.Bound(m => m.CompositeStatusText).HeaderTemplate("Status").Visible(Model.Columns.Status); })); c.Group(g => g.Title("Participation").CenterGroupHeader() .Columns(cg => { cg.Bound(m => m.ParticipationStatusText).HeaderTemplate("Participation").Visible(Model.Columns.Participation); cg.Bound(m => m.ParticipationStatusDateTimeText).HeaderTemplate("Date").Format("{0:M/d/yy}").Visible(Model.Columns.Participation); cg.Bound(x => x.LastLoginDays).HeaderTemplate("Last Login Date").Visible(Model.Columns.Participation); })); c.Bound(m => m.SharedStatus).HeaderTemplate("Shared").Visible(Model.Columns.Shared); c.Group(g => g.Title("App Dates").CenterGroupHeader() .Columns(ca => { ca.Bound(m => m.PreScreenDate).HeaderTemplate("Pre-screen").Format("{0:M/d/yy}").Visible(Model.Columns.AppDates); ca.Bound(m => m.OverallAppText).HeaderTemplate("Overall App").Format("{0:M/d/yy}").Visible(Model.Columns.AppDates); ca.Bound(m => m.PercentComplete).HeaderTemplate("% Complete").Visible(Model.Columns.AppDates).Format("{0:P}"); ca.Bound(m => m.AppUpdateDays).HeaderTemplate("App Update").Visible(Model.Columns.AppDates); })); c.Group(g => g.Title("Eligibility").CenterGroupHeader() .Columns(ce => { ce.Bound(m => m.EligibilityPrescreen).ClientTemplate( "<div>#= EligibilityPrescreen#<br/>" + "#=Eligibility.ScreeningEligible#, #=Eligibility.ScreeningQuestionable#, #=Eligibility.ScreeningIneligible#" + "</div>" ).HeaderTemplate("Pre-screen").Visible(Model.Columns.Eligibility); ce.Bound(m => m.EligibilityOverall).ClientTemplate( "<div>#= EligibilityOverall#<br/>" + "#=Eligibility.OverallEligible#, #=Eligibility.OverallQuestionable#, #=Eligibility.OverallIneligible#" + "</div>" ).HeaderTemplate("Overall").Visible(Model.Columns.Eligibility); })); c.Group(g => g.Title("Frozen").CenterGroupHeader() .Columns(cf => { cf.Bound(m => m.FrozenEnabled).ClientTemplate( "<table><thead><td>A</td><td>S</td><td>I</td><td>N</td></thead><tr>" + "<td>#=FooCount#</td>" + "<td>#=SelectedCount#</td>" + "<td>#=NotSelectedCount#</td>" + "<td>#=NetworkCount#</td>" + "</tr></table>" ).HeaderTemplate("Frozen Enabled").Visible(Model.Columns.FrozenEnabled); })); c.Bound(m => m.AlternateId).HeaderTemplate("Reference #"); foreach (var key in Model.AdminColumns.Keys) { c.Template(@<text>@item. </text>).ClientTemplate(String.Format("#=CustomFields['{0}']#", key.ToUpper())).HeaderTemplate(Model.AdminColumns[key]); } }) .Filterable() .Pageable(p => p.AlwaysVisible(true).PageSizes(new[] { 25, 50, 100, 500, 1000 })) .Sortable() .Selectable(s => s.Mode(GridSelectionMode.Multiple).Type(GridSelectionType.Row).Enabled(true)) .Resizable(r => r.Columns(true)) .NoRecords("No donors were found matching this criteria."));