MaskedTextbox allows alphabets even after setting maskType a below
@(Html.Kendo().MaskedTextBox().Name("PostalCode").Mask("000000").Value(Model.PostalCode).HtmlAttributes(new { @class = "form-control", @maxLength = "6" }))
We have a hierarchy grid where we have all the data (parents and children) available. We would like to bind the parents and all children at once, and expand all the rows. Is it possible to do with this server binding? If not, is it possible to load all the hierarchical data in one request on the client via ajax and bind it?
Basically trying not to perform a separate request for each parent row, since it's a relatively small amount of data and we have it all available.
On the ASP.NET MVC grid, I saw a DetailTemplate server property. I didn't see this on the ASP.NET Core grid.
Hi,
I'm using the server side wrappers to generate a numericTextBox like so
@Html.Kendo().NumericTextBoxFor(m => m.SumInsured).Format(
"{0:C}"
).Culture(
"en-GB"
).HtmlAttributes(
new
{ @placeholder =
"Sum Insured"
, style =
"display: inline-block;"
})
This generate the following HTML:
<
span
class
=
"k-widget k-numerictextbox"
style
=
""
><
span
class
=
"k-numeric-wrap k-state-default"
><
input
type
=
"text"
class
=
"k-formatted-value k-input"
title
=
""
tabindex
=
"0"
placeholder
=
"Sum Insured"
role
=
"spinbutton"
style
=
"display: block;"
aria-disabled
=
"false"
><
input
data-val
=
"true"
data-val-number
=
"The field SumInsured must be a number."
id
=
"SumInsured"
name
=
"SumInsured"
placeholder
=
"Sum Insured"
style
=
"display: none;"
type
=
"text"
value
=
""
data-role
=
"numerictextbox"
role
=
"spinbutton"
class
=
"k-input"
aria-disabled
=
"false"
><
span
class
=
"k-icon k-i-warning"
style
=
"display: none;"
></
span
><
span
class
=
"k-select"
><
span
unselectable
=
"on"
class
=
"k-link k-link-increase"
aria-label
=
"Increase value"
title
=
"Increase value"
><
span
unselectable
=
"on"
class
=
"k-icon k-i-arrow-60-up"
></
span
></
span
><
span
unselectable
=
"on"
class
=
"k-link k-link-decrease"
aria-label
=
"Decrease value"
title
=
"Decrease value"
><
span
unselectable
=
"on"
class
=
"k-icon k-i-arrow-60-down"
></
span
></
span
></
span
></
span
></
span
>
The problem is that because of the inline style (display: block) applied to the first input element it causes rendering issues in that the box appears to be two lines high. When you then go to change the value the first input is hidden and the second input again has an inline style (display: block) applied which has the same styling issue. In the demos I notice that instead of display: block; display: inline-block is used which does correct the issue. I'm using the same release 2017.3.1026 as the demos. I've also tried by setting an explicit inline-block through the HtmlAttributes function. I also tried with a basic input element and using the API to render the NumericTextBox but it still has the same effect. If it has an relevance this is inside of a kendo window. Any ideas as to why block instead of inline-block is applied through the JS?
Thanks,
Hi,
We have just purchased Telerik UI for ASP.NET Core.
Could I get some help trying to implement a template column that contains and Action Link like the following Tag?
<a asp-page="./Details" asp-route-id="@item.Id">Details</a>
[Using Core Razor Pages, .NET Core 2.0, VS2017]
Hi,
I have a problem with a Grid failing to Render anything.
Would it be acceptable to you for me to zip up my project/db and get some assistance?
The project itself is very small and the db is also tiny.
This is a VS2017, ASP.NET Core Razor Page.
I have one grid working, and on another page the grid does not work at all.
I suspect it maybe either a javascript library not been loaded - debugging in chrome shows no errors.
Thanks
For anyone who can help - I'm having an issue with the grid's ability to filter on a field that is of the type decimal.
Here's what my filter looks like:
restFilter.filters.push({ field: "OrderNumber", operator: "eq", value: searchValue });
Error: Message"The binary operator Equal is not defined for the types 'System.Decimal' and 'System.String'."string
Not sure what to do, any ideas?
Thanks!
Craig
For anyone who can help - I'm having an issue with gte and lte on dates in the the grid. It works fine if I put a date before and after one for a start/end date but it does not work if the date happens to be equal. For example I have a date 10/08/2014 I know is in my database for DateEntered but the record will only show if I set start date to 10/07/2014 and enddate to 10/09/2014. Neither of them can be 10/08/2014 - won't work that way even tho those filters imply the "or equal to" part.
Here's my script for the filters:
if ((startDate != "") && (Date.parse(startDate))) {
datesFilter.filters.push({ field: "DateEntered", operator: "gte", value: new Date(startDate) });
}
if ((endDate != "") && (Date.parse(endDate))) {
datesFilter.filters.push({ field: "DateEntered", operator: "lte", value: new Date(endDate) });
}
if (datesFilter.filters.length) {
$filter.push(datesFilter);
}
Any help would be greatly appreciated!
Thanks,
Craig
I am trying to figure out how I can download the files I just uploaded via the file upload control.
I was hoping the code below would give me a link I could then click on to download the file from the list in the control.
After some digging it looked like the recommended approach was to use a template on the upload control, however it looks like you are limited on what you can pass in to the model for the template.
I have the following code:
I have specified this template: I am guessing by the errors that it doesn't like the FileUploadId, ProjectId or AttachmentName fields. Is there away to provide a different model to the template?
<script id="fileUploadTemplate" type="text/x-kendo-template">
<span class='k-progress'></span>
<div class='file-wrapper'>
<a href="/ProductFiles/Upload/DownloadFile?fileUploadId=#= FileUploadId #&Projectd=#= ProjectId #">#= AttachmentName #</a>
<button type='button' class='k-upload-action'></button>
</div>
</script>
@(Html.Kendo().Upload()
.Name("projectFiles")
.Files(
files => {foreach (var f in Model.ProjectUploads)
{
files.Add().Name(f.FileName).Extension(f.UploadType).Size(f.FileSize);
}
})
.Async(a => a
.Save("Save", "Upload", new { area="Products" })
.Remove("Remove", "Upload", new { area = "Products" })
.SaveField("files")
)
.Events(events=>events
.Upload("onProjectFileUpload")
.Remove("onProjectFileUpload")
).TemplateId("fileUploadTemplate")
)
my controller method is:
public FileStreamResult DownloadFile(int fileUploadId, int projectId)
{
var uploads = GetUploadsByProjectId(projectId);
var attachment = uploads.Where(up => up.FileUploadId == fileUploadId).FirstOrDefault();
if (attachment != null)
{
string contentType = "application/octetstream";
var fileStreamResult = new FileStreamResult(new FileStream(attachment.FilePath, FileMode.Open, FileAccess.Read), contentType);
fileStreamResult.FileDownloadName = attachment.FileName;
return fileStreamResult;
}
}
Given the above code, Is this the best way to implement this? Is there another way all together I should be looking at?
Thanks,
Nick
My controller will start several async method, then my cshtml will show a long time white page. I do not want it.
I want to add a a Indeterminate ProgressBar when these async task is running, and when the task is completed, I want to hide this progressbar.
Thanks.
Xavier
I am creating a data-entry page on an ASP.NET MVC Core application using EF Core.
I am using ViewData to populate the ComboBox.
public IActionResult Add()
{
ViewData["CostCenterID"] = _context.CostCenters.ToList();
ViewData["ReasonCodeID"] = _context.ReasonCodes.ToList();
ViewData["ShiftID"] = _context.Shifts.ToList();
return View();
}
The razor view for one of the combo boxes looks like this:
<div class="form-group">
@Html.LabelFor(model => model.Shift, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@(Html.Kendo().ComboBoxFor(model => model.Shift.ShiftID)
.HtmlAttributes(new { @class = "form-control", @style = "width: 35%;" })
.Placeholder("Select a shift...")
.DataValueField("ShiftID")
.DataTextField("Name")
.BindTo((System.Collections.IEnumerable)ViewBag.ShiftID)
)
<span asp-validation-for="Shift" class="text-danger"></span>
</div>
</div>
When I save the form, the Shift property is set and the ShiftID property is still 0. There are a total of 5 combo boxes on this form. One is used just to cascading another combo box. That combo box sets the Entity property as well, and that two needs the ID set. I figure once one gets solved the rest will fall in place. If I use regular select objects with asp-for properties it works, but I want to use the Telerik controls.
The save method looks like this:
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Add(DownTimeEntry downTimeEntry)
{
if (ModelState.IsValid)
{
_context.Add(downTimeEntry);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
ViewData["CostCenterID"] = _context.CostCenters.ToList();
ViewData["ReasonCodeID"] = _context.ReasonCodes.ToList();
ViewData["ShiftID"] = _context.Shifts.ToList();
return View(downTimeEntry);
}
Any help on this would be appreciated!