Telerik Forums
UI for ASP.NET Core Forum
1 answer
250 views

Hello,

I am trying to get a grid to work with checkbox instead of the "true"/"false".

I found the faq for ASP.NET (https://docs.telerik.com/aspnet-mvc/helpers/grid/faq#how-to-display-checkboxes-in-ajax-bound-grids) but nothing similar for .net core.

When I try to use this on my asp.net core mvc project, I get always the error, that the given variable is not defined.

 

In general, can the ASP.net MVC examples be used on ASP.net core MVC?

Regards

Patrick

Stefan
Telerik team
 answered on 02 Nov 2017
1 answer
352 views

Hello,

I have a hierarchical grid and I want to export it to pdf, but when I do this, only 2 pages are created, the rest is cut.

Can anybody tell me what I have to set, so that the complete grid is exported?

I also have another problem with the grid. The ProxyURL-Function does not work. The according method in code behind is never be executed and I don't know why. 

Here is the code:

<div class="col-sm-12" id="main">
            @(Html.Kendo().Grid<CMG_Configuration_Manager.Models.MachineInfo>()
        .Name("grid")
        .ToolBar(tools => tools.Pdf())
        .Pdf(pdf => pdf
            .AllPages()
            .AvoidLinks()
            .PaperSize("A4")
            .Scale(0.8)
            .Margin("2cm", "1cm", "1cm", "1cm")
            .Landscape()
            .TemplateId("page-template")
            .FileName("Kendo UI Grid Export.pdf")
            .ProxyURL(Url.Action("Pdf_Export_Save", "Home"))
             
        )
   
        .HtmlAttributes(new { style = "height: 800px; width:1000px" })
        .Scrollable(scrollable => scrollable.Height("auto"))
        .Groupable()
        .Sortable()
        .ClientDetailTemplateId("TemplateMaterial")
        .DataSource(dataSource => dataSource
            .Ajax()
            //.PageSize(10)
            .Read(read => read.Action("getSpGrid", "Home"))
        )
        .Events(events => events.DataBound("dataBound"))
            )
   
<script id="TemplateMaterial" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<CMG_Configuration_Manager.Models.MaterialInfo>()
            .Name("grid_#=msn_pkfk_serialnr_vchar#") // template expression, to be evaluated in the master context
            .DataSource(dataSource => dataSource
                .Ajax()
                .Read(read => read.Action("HistorianBinding_Material", "Home", new { SerialNr = "#=msn_pkfk_serialnr_vchar#" }))
            )
            .Events(events => events.DataBound("dataBound"))
            .Sortable()
            .ToClientTemplate()
             
            
    )
//And the Code in HomeController
 
[HttpPost]
        public ActionResult Pdf_Export_Save(string contentType, string base64, string fileName)
        {
            var fileContents = Convert.FromBase64String(base64);
 
            return File(fileContents, contentType, fileName);
        }
Stefan
Telerik team
 answered on 31 Oct 2017
3 answers
630 views

Hello, I want to create a grid with multi level hierachy, but the grid only shows to levels of hierachy. Here is the code of my view:

<div class="col-sm-12" id="main">
            @(Html.Kendo().Grid<CMG_Configuration_Manager.Models.MachineInfo>()
        .Name("grid")
        .ToolBar(tools => tools.Pdf())
        .Columns(columns =>
        {
            columns.Bound(o => o.msn_pkfk_serialnr_vchar);
            columns.Bound(o => o.mtp_pkfk_gang_vchar);
            columns.Bound(o => o.mtp_pkfk_mcid_vchar);
            columns.Bound(o => o.msb_kunde_vchar);
        })
        .HtmlAttributes(new { style = "height: 800px; width:1000px" })
        .Scrollable(scrollable => scrollable.Height("auto"))
        .Groupable()
        .Sortable()
        .ClientDetailTemplateId("TemplateMaterial")
        .Pageable()
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(10)
            .Read(read => read.Action("getSpGrid", "Home"))
        )
        .Events(events => events.DataBound("dataBound"))
            )
        </div>
    </div>
     
</div>
<script id="TemplateMaterial" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<CMG_Configuration_Manager.Models.MaterialInfo>()
            .Name("grid_#=msn_pkfk_serialnr_vchar#") // template expression, to be evaluated in the master context
            .ClientDetailTemplateId("TemplateFacility")
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(5)
                .Read(read => read.Action("HistorianBinding_Material", "Home", new { SerialNr = "#=msn_pkfk_serialnr_vchar#" }))
            )
            .Sortable()
            .ToClientTemplate()
 
    )
</script>
<script id="TemplateFacility" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<CMG_Configuration_Manager.Models.FacilityInfo>()
            .Name("grid_#=bgp_pkfk_bgpnr_vchar#") // template expression, to be evaluated in the master context
            .ClientDetailTemplateId("TemplateModule")
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(5)
                .Read(read => read.Action("HistorianBinding_Facility", "Home", new { GroupName = "#=bgp_pkfk_bgpnr_vchar#" }))
            )
            .Sortable()
            .ToClientTemplate()
 
    )
</script>

 

The grid shows the first and second level. At each row of second level is this little arrow to expand the data (where the third level should show up), but when i press the arrow the following error occurs:

Uncaught TypeError: Cannot read property 'replace' of undefined
    at Object.compile (kendo.all.min.js:25)
    at Object.d [as template] (jquery.min.js:2)
    at eval (eval at <anonymous> (jquery.min.js:2), <anonymous>:1:4106)
    at Object.n [as syncReady] (kendo.aspnetmvc.min.js:25)
    at eval (eval at <anonymous> (jquery.min.js:2), <anonymous>:1:7)
    at eval (<anonymous>)
    at jquery.min.js:2
    at Function.globalEval (jquery.min.js:2)
    at Ha (jquery.min.js:3)
    at n.fn.init.after (jquery.min.js:3)

Can anybody help or has an idea to do the trick on .net Core MVC?

Regards

Patrick

Stefan
Telerik team
 answered on 30 Oct 2017
0 answers
241 views

Hi,

 I want to perform sending email operation with attachments,subject,To and From on button click.

I have gone through the below link

https://www.telerik.com/forums/open-email-and-attach-grid-as-pdf-or-excel(It does not help as it has either gmail or outlook as email option)

The second option I found is https://www.telerik.com/forums/how-to-send-email-with-attachment. But need some help with the Plugins.I want to know whether this is a free plugins and also are there any other options i have to implement my requirement.

Thanks,

Indhu

Indhumathi
Top achievements
Rank 1
 asked on 26 Oct 2017
2 answers
143 views

I Have unchecked the ComboBox items by using clearCheckedItems() inside a Clear button.But Now I am trying to clear the selected Values without the clear Button.Is there any way I can clear the checked Values for the ComboBox.

 

Thanks,

Indhu

Indhumathi
Top achievements
Rank 1
 answered on 26 Oct 2017
1 answer
123 views

Using the sample at:  http://demos.telerik.com/aspnet-core/multiselect/index  

  1. Set focus into the Optional field
  2. Start typing "Nan
  3. Use the down arrow to select the 2nd Nancy
  4. Tab out

The selected record is not added to the selected values.  The only way I have found to actually add it, is by using the mouse.  This greatly slows down our data entry staff.  Why does it not behave the same way as the combobox, or autocomplete field?

For example, go to http://demos.telerik.com/aspnet-core/autocomplete/index type in "Den", down arrow to select Denmark and tab, Denmark is now populated in the autocomplete field.  Same occurs with combo boxes.

 

Ivan Danchev
Telerik team
 answered on 23 Oct 2017
1 answer
783 views
I would like to allow a dropdownlist to show values that were previously selected but are now removed from the dropdownlist source.  Instead of displaying blank.  The dropdownlist is in a grid column.

Grid:
...
columns.ForeignKey(p => p.CurrentCategory, @Model.LookupCategory, "CategoryName", "CategoryName").Width(160);
...



Template editor
@using System.Collections
 
@(
 Html.Kendo().DropDownListFor(m => m)      
        .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
        .ValuePrimitive(true)       
        .AutoWidth(true)
)


So to explain in more detail:  The CurrentCategory column is a text column (not an id column) and the user can select from a list of items found in the LookupCategory.  However if an item is removed from the LookupCategory the value should still be displayed in instances where the user had already selected that value for the CurrentCategory.  

Currently if a row contains a CurrentCategory value that is not in the LookupCategory list it is displayed as blank.

Perhaps I have to use a combobox instead? 
Viktor Tachev
Telerik team
 answered on 23 Oct 2017
1 answer
239 views

Hello,

I know that it is possible to trigger the click event of a toolbar button like this:

$("#tlbMitglieddokumente > .k-button").click();

 

but how to trigger the toggle Event?

robert

Ivan Danchev
Telerik team
 answered on 19 Oct 2017
2 answers
141 views

Hi, 

after i try the demo http://demos.telerik.com/aspnet-core/grid/custom-command.

 

I have an issue showing details data from foreignkey , if you confused what im talking about , here's my code to give you some insight.

View :

<div style="padding:10px;" >
    @(Html.Kendo().Grid<DevRedsMk3.Models.MasterOpportunity>()
        .Name("Opportunity")
        .Columns(columns =>
        {
            columns.Bound(p => p.OpportunityId).Title("Opportunity ID");
            columns.Bound(p => p.OpportunityName).Title("Opportunity Name");
            columns.ForeignKey(p => p.ProspectId, (System.Collections.IEnumerable)ViewData["prospects"], "ProspectId", "ProspectId").Hidden(true).Title("Prospect Id");
            columns.ForeignKey(p => p.ProspectId, (System.Collections.IEnumerable)ViewData["prospects"], "ProspectId", "ProspectName").Hidden(true).Title("Prospect Name");
            columns.ForeignKey(p => p.ProspectId, (System.Collections.IEnumerable)ViewData["prospects"], "ProspectId", "Type").Hidden(true).Title("Type");
            columns.ForeignKey(p => p.ProspectId, (System.Collections.IEnumerable)ViewData["prospects"], "ProspectId", "Email").Hidden(true).Title("Email");
            columns.ForeignKey(p => p.ProspectId, (System.Collections.IEnumerable)ViewData["prospects"], "ProspectId", "Phone").Hidden(true).Title("Phone");
            columns.ForeignKey(p => p.ProspectId, (System.Collections.IEnumerable)ViewData["prospects"], "ProspectId", "Address").Hidden(true).Title("Address");
            columns.ForeignKey(p => p.ProspectId, (System.Collections.IEnumerable)ViewData["prospects"], "ProspectId", "IdNumber").Hidden(true).Title("ID Number");
            columns.ForeignKey(p => p.ProspectId, (System.Collections.IEnumerable)ViewData["prospects"], "ProspectId", "Npwp").Hidden(true).Title("NPWP");
            columns.ForeignKey(p => p.ProspectId, (System.Collections.IEnumerable)ViewData["prospects"], "EmployeeId", "EmployeeId").Hidden(true).Title("Sales Person");
            columns.Command(command => command.Custom("Details").Click("showDetails")).Width(100);
            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(185);
 
 
        })
        .ToolBar(toolbar => toolbar.Create())
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Scrollable()
 
        .Sortable()
 
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .DataSource(datasource => datasource
             .Ajax()
             .ServerOperation(false)
             .Model(model => { model.Id(p => p.OpportunityId);
                 model.Field(p => p.OpportunityId).Editable(false);
             })
 
 
 
 
 
             .Read(read => read.Action("CustomCommand3_Read", "MasterOpportunity"))
             .Read(read => read.Action("List", "MasterOpportunity"))
             .Create(create => create.Action("Create", "MasterOpportunity"))
             .Update(update => update.Action("Update", "MasterOpportunity"))
        )
    )
 
    @(Html.Kendo().Window().Name("Details")
        .Title("Opportunity Details")
        .Visible(false)
        .Modal(true)
        .Draggable(true)
        .Width(600)
    )
    <script type="text/x-kendo-template" id="template">
        <div id="details-container">
            <h2>#= OpportunityName #</h2>
            <em>#= OpportunityId #</em>
            <dl>
                <dt>Prospect ID: #= ProspectId #</dt>
              @*  <dt>Name: #= ProspectName #</dt>
    <dt>Type: #= Type #</dt>
    <dt>Email: #= Email #</dt>
    <dt>Address: #= Address #</dt>
    <dt>Phone : #= Phone #</dt>
    <dt>KTP: #= IdNumber #</dt>
    <dt>NPWP: #= Npwp #</dt>
    <dt>Sales Person: #= EmployeeId#</dt>*@
            </dl>
        </div>
    </script>
 
    <script type="text/javascript">
    var detailsTemplate = kendo.template($("#template").html());
 
    function showDetails(e) {
        e.preventDefault();
 
        var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
        var wnd = $("#Details").data("kendoWindow");
 
        wnd.content(detailsTemplate(dataItem));
        wnd.center().open();
    }
    </script>
 
</div>

 

 

you can see the commented code in <div id="details-container">  , im not able to show that, so please help me with it.. :)

 

here's my controller :

namespace DevRedsMk3.Controllers
{
    public class OpportunityController : Controller
    {
        private readonly dbdevredsContext _context;
 
        public OpportunityController(dbdevredsContext context)
        {
            _context = context;
        }
        // GET: /<controller>/
        public IActionResult Index()
        {
            var prospects = _context.MasterProspect.ToList();
 
            ViewData["prospects"] = prospects;
            ViewData["defaultMasterProspect"] = prospects.First();
 
            var employee = _context.MasterEmployee.ToList();
 
            ViewData["employee"] = employee;
            ViewData["defaultMasterEmployee"] = employee.First();
 
            return View();
        }
 
        public IActionResult Error()
        {
            return View();
        }
    }
}
namespace DevRedsMk3.Controllers
{
    public class MasterOpportunityController : Controller
    {
         
 
        private readonly dbdevredsContext _context;
 
        public MasterOpportunityController(dbdevredsContext context)
        {
            _context = context;
        }
        public IActionResult List([DataSourceRequest] DataSourceRequest request)
        {
            return Json(_context.MasterOpportunity.ToDataSourceResult(request));
        }
        //public ActionResult CustomCommand3_Read([DataSourceRequest] DataSourceRequest request)
        //{
        //    return Json(_context.MasterEmployee.ToDataSourceResult(request));
        //}
 
        [HttpPost]
        public ActionResult Update([DataSourceRequest]DataSourceRequest request, Models.MasterOpportunity master)
        {
            if (master != null && ModelState.IsValid)
            {
                _context.MasterOpportunity.Update(master);
                _context.SaveChanges();
            }
            return Json(new[] { master }.ToDataSourceResult(request, ModelState));
        }
 
        [HttpPost]
        public ActionResult Destroy([DataSourceRequest]DataSourceRequest request, Models.MasterOpportunity opportunity)
        {
            _context.Remove(opportunity);
            _context.SaveChanges();
 
            return Json(new[] { opportunity }.ToDataSourceResult(request, ModelState));
        }
 
        [HttpPost]
        public ActionResult Create([DataSourceRequest]DataSourceRequest request, Models.MasterOpportunity opportunity)
        {
            if (opportunity != null && ModelState.IsValid)
            {
                _context.Add(opportunity);
                _context.SaveChanges();
            }
            return Json(new[] { opportunity }.ToDataSourceResult(request, ModelState));
        }
    }
 
}
Preslav
Telerik team
 answered on 18 Oct 2017
1 answer
329 views

Hello,

the grid Checkbox selection is not working if I set the grid selection mode explicitly to singe or multiple:

.Selectable(s => s.Mode(GridSelectionMode.Single))
or
.Selectable(s => s.Mode(GridSelectionMode.Multiple))

If I doesn't set it it works like expected...

Is this a bug? (see Video here: https://www.screencast.com/t/RsiHfg9Oxr)

robert

Viktor Tachev
Telerik team
 answered on 16 Oct 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?