Telerik Forums
UI for ASP.NET MVC Forum
9 answers
2.8K+ views
Hi! I'm using the KendoUI Grid with MVC 4.  I'm trying to figure out how to automagically save the cell data when I step out of the cell.  I can get it to save using a "Save" button and batch editing, but my requirements are such that they don't want to have to press the "Save" button.

Thanks for your help in advance.
Dimiter Madjarov
Telerik team
 answered on 10 Jun 2015
1 answer
328 views

In one of our projects, we are using Kendo UI Q2 and we cannot upgrade because of IE8 support and we need Export to Excel & Export to PDF features. So we decided to take these features to server side.

By googling, I found following sample projects from github:

https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/excel-export-server-side

https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/pdf-export-server-side

These seem to be helping but in the PDF part I see that iTextSharp is used and it's commercial license is NOT FREE. What I want to confirm is that by having a valid license of Telerik DevCraft, can we use iTextSharp commercially or do we need separate license for it?

 

Any other help or solution will be highly appreciated.

Dimiter Madjarov
Telerik team
 answered on 10 Jun 2015
6 answers
925 views
Hi All,

Initially we are using Telerik ASP.NET combo box. For this having load on demand option ( link). Now we are moving to Kendo UI combo box.
This combo box doesn't contain all options (which are present in telerik asp.net combobox) like Load on demand , ShowMoreResultsBox.. etc.  

Could you please provide solution for updating item on Load on demand 
@(Html.Kendo().ComboBox()
         .Name("fabric")
         .Filter("contains")
         .Placeholder("Select fabric...")
         .DataTextField("Text")
         .DataValueField("Value")
         .DataSource(source =>
             source.Read(read =>
                     {
                         read.Url("http://localhost:59590/api/Search/LoadonDemand");
                     }).ServerFiltering(true))
         .HighlightFirst(true)
         .IgnoreCase(true)
Nuno
Top achievements
Rank 2
 answered on 09 Jun 2015
2 answers
154 views
Hi There,

I'm working on an Umbraco CMS Project , in which in one of the page I need to use telerik Upload control (to upload large files)- I have worked on this component in separate MVC project and I am happy with its working status, now i need to integrate this functionality in Umbarco CMS, I referenced Kendo.MVC.dll in CMS project, and have copied CSS and JS relating to component in respective folder and all paths are updated where necessary, now CMS project has stopped working i.e published content is inaccessible within CMS pages, it used to work earlier, If I remove reference CMS project starts working again- So I'm unable to embed kendo UI related changes into the Umbraco CMS. could you please advise me how this can be addressed.

Thanks
Satish
Geoff
Top achievements
Rank 1
 answered on 09 Jun 2015
2 answers
454 views

Is it possible to mask a phone number with or without an extension?  I'm looking for:

(612) 555-1212

or

(612) 555-1212 ext. 5

or

(612) 555-1212 ask for Larry

 Basically, the beginning of the string must be formatted as a phone number, but the user can enter whatever they want after that. 

 Can I do it?

 Thanks!

Laurie
Top achievements
Rank 2
 answered on 09 Jun 2015
1 answer
586 views
 I have a dynamic model below is the cshtml code, is line editing possible with dynamic model ? 
 
@(Html.Kendo().Grid<dynamic>()
              .Name("requestCapacity")
              .Columns(columns =>
              {
                  foreach (var c in Model)
                  {
                      if (c.Equals("Week Starting"))
                          columns.Template(@<text> </text>).ClientTemplate(@"<span class='k-widget k-datepicker' style='width: 150px;'><span class='k-picker-wrap k-state-default'><input id='datepicker'  style='width: 100%;' data-role='datepicker' type='text' class='k-input' role='combobox' aria-expanded='false' aria-owns='datepicker_dateview' aria-disabled='false' aria-readonly='false' aria-activedescendant='270cfa37-b189-46a8-b0ea-857df06f84ab_cell_selected'><span unselectable='on' class='k-select' role='button' aria-controls='datepicker_dateview'><span unselectable='on' class='k-icon k-i-calendar'>select</span></span></span></span>").Width(150).Title(c.Key);
                      else
                          columns.Template(@<text>c</text>).Title(c.Key);
 
                  }
                  columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
              }
      )
              .Editable(editable => editable.Mode(GridEditMode.PopUp))
                  .HtmlAttributes(new { style = "height:auto;width:85%;align:center;margin:0 auto" })
                  .Pageable()
                  .ToolBar(toolbar => toolbar.Create().Text("Add"))
              .Sortable()
              .Scrollable().EnableCustomBinding(true)
               .DataSource(dataSource => dataSource
                      .Ajax().Model(model =>model.Id("ID")
                      )
                  .PageSize(10)
                    .Events(events => events.Error("error_handler"))
                                   .Create(update => update.Action("EditingInline_Update", "RequestCapacity",new {testing="#=dataItem#"}).Type(HttpVerbs.Post))
                          .Read(read => read.Action("PopulateRequest", "RequestCapacity").Type(HttpVerbs.Post))
                                  .Update(update => update.Action("EditingInsline_Update", "RequestCapacity","#=dataItem#").Type(HttpVerbs.Post))
                          .Destroy(update => update.Action("EditingInline_Destroy", "Capacity"))
              )
)

 

controller code.

public ActionResult RequestCapacityPopUp()<br>        {<br>            var dynamicBinding = new List<string>(){"Week Starting"};<br>            using (var dataModel = new CapacityPlannerEntities())<br>            {<br>                foreach (var team in dataModel.Teams)<br>                {<br>                    dynamicBinding.Add(team.TeamName);<br>                }<br>            }<br>            return View(dynamicBinding);<br>        }

Alexander Popov
Telerik team
 answered on 09 Jun 2015
1 answer
188 views

Hi

How do I pass a value from the button .content

@(Html.Kendo().Button()
                .Name("p14")
                 .HtmlAttributes(new { type = "button" })
                .Content("135")
                       .Events(ev => ev.Click("onClickPol")))
     <script>
    function onClickPol(e) {
       //This dos not work, I want to retrieve the name, content of that button what n this case is 135
        var xContent  = $(e.event.target).closest(".k-button").attr("textContent")

    }
    </script>

Dimiter Madjarov
Telerik team
 answered on 09 Jun 2015
1 answer
426 views

Strange that I have one grid instance where I created a custom ClientRowTemplate, as I needed to display an image and other info...

I have 2 custom command buttons, one to show Item Details, and another to Copy Item details, basically pointing to distinct jQuery functions that get the id of the record in the row then redirect to a specific controller action.

 

It seems that regardless of which button is clicked, the first function is being fired...

 

Here is the grid markup...

 @(Html.Kendo().Grid<LibEquipmentApp.ViewModels.SimpleItemViewModel>()
.Name("ManageItems")
.Columns(columns =>
{
columns.Bound(p => p.EItemID).Width(0).Visible(false);
columns.Bound(p => p.ECatID)
.Width(0)
.Visible(false);
columns.Bound(p => p.ImgPath)
.Filterable(false)
.Width(80)
.Title("Photo");
columns.Bound(p => p.EItemName)
.Width(240)
.Title("Item Name");
columns.Bound(p => p.SDBBarcode)
.Width(100)
.Title("Barcode #");
columns.Command(command => { command.Custom("Details").Click("showDetails"); command.Custom("Copy").Click("showCopy"); }).Width(140);
})
.ClientRowTemplate(
"<tr class='k-std' data-imgpath='#: ImgPath #'>" +
"<td >" +
"<img class='img-responsive' src='" + Url.Content("~/Images/EqImg/") + "#:data.ImgPath#' alt='#: data.EItemName #' />" +
"</td>" +
"<td class='details'>" +
"<span class='name'>#: EItemName# </span>" +
"</td>" +
"<td class='details'>" +
"#: SDBBarcode #" +
"</td>" +
"<td class='details'>" +
"<a class='k-button k-button-icontext k-grid-Details'><span>Details</span> </a>" +
"<a class='k-button k-button-icontext k-grid-Details'><span>Copy</span> </a>" +
"</td>" +
"</tr>"
)
.ClientAltRowTemplate(
"<tr class='k-altz' data-imgpath='#: ImgPath #'>" +
"<td >" +
"<img class='img-responsive' src='" + Url.Content("~/Images/EqImg/") + "#:data.ImgPath#' alt='#: data.EItemName #' />" +
"</td>" +
"<td class='details'>" +
"<span class='name'>#: EItemName # </span>" +
"</td>" +
"<td class='details'>" +
"#: SDBBarcode #" +
"</td>" +
"<td class='details'>" +
"<a class='k-button k-button-icontext k-grid-Details'><span>Details</span> </a>" +
"<a class='k-button k-button-icontext k-grid-Details'><span>Copy</span> </a>" +
"</td>" +
"</tr>"
)
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts with")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
.Contains("Contains")
))
)
.Pageable()
.Navigatable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:600px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Events(events => { events.Error("error_handler"); events.RequestEnd("onRequestEnd"); })
.Model(model =>
{
model.Id(p => p.EItemID);
})
.Read(read => read.Action("Items_Read", "Admin"))
)
)

 

And here are the functions....

 <script type="text/javascript">
function showDetails(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var id = dataItem.EItemID;
$.ajax({
url: "/Admin/ManageItem",
//send current record ID to the server
data: { id: dataItem.EItemID },
error: function () {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
},
success: function (data) {
window.location = '/Admin/ItemDetails?id=' + id;
}
})
}
function showCopy(e) {
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var id = dataItem.EItemID;
$.ajax({
url: "/Admin/CopyItem",
//send current record ID to the server
data: { id: dataItem.EItemID },
error: function () {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
},

success: function (data) {
window.location = '/Admin/CopyItem?id=' + id;
}
})
}
function selectedIndexChanged(e) {
var value = this.value();
var grid = $("#ManageItems").data("kendoGrid");
if (value) {
grid.dataSource.filter({ field: "ECatID", operator: "eq", value: value });
} else {
grid.dataSource.filter({});
}
return;
}
function error_handler(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}
function onRequestEnd(e) {
$(".ref-success").load(window.location + " .ref-success")
}
</script>

 

The showDetails() function is always being fired... Any help would be greatly appreciated! Thanks!

Sergiu
Top achievements
Rank 2
 answered on 08 Jun 2015
1 answer
100 views

When in the Kendo editor image browser, there is a delete button that is only visible when a file or folder is selected. It invokes the "Destroy" post. When pressed a javascript confirmation is invoked with the message "Are you sure you want to delete "{fileName}"". How would I override this message in MVC Razor. 

Thanks

Alexander Popov
Telerik team
 answered on 08 Jun 2015
1 answer
180 views
Has there been any progress in developing a pluggable standalone File Browser.
Sebastian
Telerik team
 answered on 08 Jun 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?