Telerik Forums
UI for ASP.NET Core Forum
4 answers
266 views

Hi, I was able to embed video using my own template and on change event under image browser.

                            change: function () {
                                var editor = $('#editor').data("kendoEditor");
                                var template = kendo.template($("#video-template").html());
                                var filename = $(".k-imagebrowser").find(".k-state-selected").children("strong").text();
                                var range = editor.getRange();
                                editor.selectRange(range);
                                editor.exec("insertHtml", { value: template({ source: $(".k-imagebrowser").data("kendoImageBrowser").dataSource.data()[0].blob + '/' + filename })});

                            }

 

but after the insert button click, it clears any content inside the editor.

 

Rumen
Telerik team
 answered on 17 Aug 2018
3 answers
875 views

I have already raised an issue on Stack Overflow about this and it is worth extending my enquiries here before my head explodes from the constant banging against my desk...
It's a simple question which will allow me to refactor my code (or not) before I pass an IQueryable to the toDataSource() method.

Does toDataSource() use async methods internally?

I am having problems with second operation on the context with a nested code block called from within my IQueryable.  The Stack Overflow post will explain in more depth.

Thanking anyone who can help in advance!

Stefan
Telerik team
 answered on 17 Aug 2018
2 answers
376 views

I've created a ViewComponent which shows details of a budget.  I pass the budget details model into to the ViewComponent, which works displaying the info, but once I make a change to the cost column (only column you can change). and Click the Save toolbar button... nothing happens.. except the grid is now empty and I see a busy indicator which never stops.  I based my code on the batch example found here: https://docs.telerik.com/aspnet-mvc/helpers/grid/editing/batch-editing   Any help would be appreciated.

 

bud_detailsController:

public ActionResult Editing_Read([DataSourceRequest] DataSourceRequest request)
       {
           IQueryable<bud_details> budgets = _context.Bud_Details;
           DataSourceResult result = budgets.ToDataSourceResult(request);
           return Json(result);
       }
       //[AcceptVerbs("Post")]
       public ActionResult Editing_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<bud_details> budget)
       {
           var entities = new List<bud_details>();
           if (budget != null && ModelState.IsValid)
           {
               foreach (var bud in budget)
               {
                   // _context.Update(budget);
                   var entity = new bud_details
                   {
                       budget_no = bud.budget_no,
                       code = bud.code,
                       cost = bud.cost,
                       description = bud.description,
                       u_key = bud.u_key,
                       project_no = bud.project_no,
                       id = bud.id,
                       section = bud.section
                   };
                   entities.Add(entity);
                   _context.Bud_Details.Attach(entity);
                   _context.Entry(entity).State = EntityState.Modified;
               }
               _context.SaveChanges();
           }
           return Json(entities.ToDataSourceResult(request, ModelState, p => new bud_details
           {
               budget_no = p.budget_no,
               code = p.code,
               cost = p.cost,
               description = p.description,
               u_key = p.u_key,
               project_no = p.project_no,
               id = p.id,
               section = p.section
           }));
       }

 

 

The ViewComponent:

@(Html.Kendo().Grid(@Model.BudgetDetails)
            .Name("BudgetGrid")
            .Columns(columns =>
            {
                columns.Bound(p => p.u_key).Visible(false);
                columns.Bound(p => p.budget_no).Visible(false);
                columns.Bound(p => p.code).Width(100);
                columns.Bound(p => p.description);
                columns.Bound(p => p.cost).Width(200)
                .ClientFooterTemplate("Grand Tot: #= kendo.toString(sum, 'C') #")
                .ClientGroupFooterTemplate("Tot: #= kendo.toString(sum, 'C') #");
            })
            .ToolBar(toolbar =>
            {
                toolbar.Save();
                //toolbar.Pdf();
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            // .Pageable(p => p.Numeric(false).PreviousNext(false))
            //.HtmlAttributes(new { style = "height:550px;" })
            //.Navigatable()
            .Sortable()
            .Scrollable(sc => sc.Endless(true))
            .Filterable()
            .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(true)
                .ServerOperation(false)
                .Aggregates(aggregates =>
                {
                    aggregates.Add(p => p.cost).Sum();
                })
                .Group(groups => groups.Add(p => p.Category))
                .Events(events => events.Error("error_handler"))
                .Model(model => {
                    model.Id(p => p.u_key);
                    model.Field(p => p.code).Editable(false);
                    model.Field(p => p.description).Editable(false);
                })
                .Read(read => read.Action("Editing_Read", "bud_details"))
                .Update(update => update.Action("Editing_Update","bud_details"))
                )
)

 

P.S.  I put breakpoints in "Editing_Read" and "Editing_Update" and they never get hit.  I don't know why they are not being called.

 

Lester

Attila Antal
Telerik team
 answered on 15 Aug 2018
1 answer
208 views

Hi,

I am using TagHelpers to create multiselects in my form. I need to provide custom filtering function to filter my data by two fileds e.g FirstName and LastName (contains FirstName OR contains LastName). How can I do that?

 

Nencho
Telerik team
 answered on 15 Aug 2018
4 answers
1.1K+ views

I have a few groups of columns in my inline grid using columns.Group. I know I can hide these column groups entirely, but I have a dropdown in each row of the grid, and based on what is selected in that dropdown, I am firing a javascript event and examining the selected value. Based on this selected value, I would like to disable or hide these groups of columns in that particular row only! How can I go about doing this?

<p>//this is where I am firing the event:<br>columns.Bound(p => p.sb).Width(200).ClientTemplate("#= sbchange(sb) #");</p><p></p><p>//this is the js function:</p><p>//can i get the row num passed in as a parameter as well?<br>function sbchange(sb) {</p><p>//i would like to disable  columns/fields.of the row where the sb was changed. It's better if i can somehow access the whole column group for that row,</p><p>//so i don't have to go field by field and disable them.</p><p>}</p>
Preslav
Telerik team
 answered on 15 Aug 2018
5 answers
491 views

I cannot figure out how to change the buttons on the grids where "Export to Excel" or "Export PDF" is enabled.  What style can I set (override) that will control the .css for the buttons?

Vessy
Telerik team
 answered on 15 Aug 2018
10 answers
445 views

I see the post below this one with respect to the client group header and it works but must be added to each column.

1) How can I just add text to the grouping header changing it from the default text to "Grouped by Columns : " when the user drags a column there.  And then return it to default text when the user has clicked the icon to remove the grouping on that column?

2) How can I set the minimum width for the column indicator in the grouping header.  Right now it is truncating the text of the column name if it is too wide.

Thanks

Eyup
Telerik team
 answered on 14 Aug 2018
3 answers
242 views

Are there any plans to implement scaffolding in aspnetcore mvc?

 

thanks!

Pavlina
Telerik team
 answered on 13 Aug 2018
1 answer
191 views

I have a simple tag helper for my editor. I am using the 'For' attribute because I am binding to a viewmodel. When the property for this viewmodel is loaded, by default, it loads in as null because its a new object. In other words, my ViewModelObject has a property called 'Content' and that is a string that is null when created. So, when I use this code below in my Razor view, it returns back an error that object is not initialized. But if I set that property to an empty string ("") then it will load fine.

So the question is, is this expected behavior or should it still load regardless? My opinion, it shouldn't matter if it is null or not. It should still give a blank editor.

Thanks

<kendo-editor for="Content">
    <resizable enabled="true" />
    <content>
 
    </content>
    <tools>
        <tool name="formatting" />
        <tool name="bold" />
        <tool name="italic" />
        <tool name="underline" />
        <tool name="justifyLeft" />
        <tool name="justifyCenter" />
        <tool name="justifyRight" />
        <tool name="insertUnorderedList" />
        <tool name="insertOrderedList" />
        <tool name="indent" />
        <tool name="createLink" />
        <tool name="tableEditing" />
    </tools>
</kendo-editor>
Veselin Tsvetanov
Telerik team
 answered on 13 Aug 2018
1 answer
574 views
Hello, can someone (admin) provide me a thorough working example on how to have a Multi-select have its values fetched using ajax when a dropdown is changed in a row in a grid when doing inline editing? I'm using Asp.Net MVC. I've looked at some samples, but seems that CascadeFrom() function is not supported in a multi-select.  Please provide working sample for both inline grid and popup.
Viktor Tachev
Telerik team
 answered on 08 Aug 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?