Telerik Forums
UI for ASP.NET MVC Forum
2 answers
225 views
What do I need to configure to get this toggle button to show up on my Scheduler control using MVC? Consulting the sample code that generates this gives me no clues.
Responsive
Top achievements
Rank 1
Veteran
 answered on 29 Dec 2020
4 answers
2.6K+ views

Hello,

 

 

I  am working with telerik ui for asp.net mvc.

I have a textbox named path of poste.

By entering, it should show me the tree view of my local directories in a window.

when I select a directory, I need to show only the full path in my text box.

So i need to show the path of the selected folder from my local folders. How can I do this ?

Any help or suggestions please ?

Nikolay
Telerik team
 answered on 28 Dec 2020
1 answer
605 views

Hi,

I’m trying to use the filter component with dynamic datasource. (Asp.net MVC)
I'm writing something like this:
    @(Html.Kendo().Filter<dynamic>()
        .Fields(f =>
        {
            foreach (var field in Model.Fields)
            {
                f.Add().Label(field.Label).EditorTemplateHandler(“func”+field.type);            
            }
        }).FilterExpression(f =>
        {
            f.AddRange(Model.Filters);
        }))




For filters, I had to create my own conversion function (string json -> IFilterDescriptor) because I couldn't get the one used for the grids to work (= FilterDescriptorFactory.Create)

And now, I am blocked by the dynamic change of operators. These change depending on the type of field. However, I do not pass a field (because dynamic), and I do not have a "SetType" function as for "kendo-ui" (https://docs.telerik.com/kendo-ui/api/javascript/ui/filter/configuration/fields.type)

How can I do ?

Regards
P.S. I'm with v2020.3.915

Preslav
Telerik team
 answered on 24 Dec 2020
3 answers
1.9K+ views

I have a Kendo Editor which is defined as below:

@(Html.Kendo().Editor()
                    .Name("myEditor")
                    .Tag("div")
                    .Tools(tools => tools
                            .Clear()
                            .Bold()
                            .Italic()
                            .Underline()
                            .Strikethrough()
                            .JustifyCenter().JustifyFull().JustifyLeft().JustifyRight()
                            .CreateLink().Unlink().TableEditing().FontColor().BackColor())
                     .Value(@<text>
                                Hello Kendo Editor <some text with html tags here>
                        </text>)
                )

Then I have two buttons that show up only for the admins - Save and Edit, and they are defined as below -

<button type="button" id="btnedit">Edit</button>
 <input type="submit" name="btnSave"  id="btnSave" value="Save" class="btn btn-default" />

 

There are other two submit buttons on the form like below -

<input type="submit" name="btnAgree"  id="btnAgree"  value="Agree" class="btn btn-primary" />
<input type="submit" name="btnDisagree" id="btnDisagree" value="Disagree" class="btn btn-default" />

 

And the form handles the submit of Agree and Disagree buttons by using the BeginForm("ActionMethod", "Controller", FormMethod.Post) like below -

@using (Html.BeginForm("Index", "MyControllerName", FormMethod.Post))

 

Now I want that, when an admin user comes in and makes changes to the Editor text and hits 'Save' button, I want the text of the editor to get saved in database. I can handle the saving part. I just want to know, how can I get the text from the Kendo Editor and send the text value to the action method in the controller.  

I tried the solution provided in this thread here - http://www.telerik.com/forums/save-changes-to-and-print-content-of-editor-in-mvc

So, using the solution here I added an action method with the string argument name similar to the Editor name like below -

public ActionResult Save(string myEditor) {

// TO DO: Save the text to the database

 }

When I run my application, and hit 'Save' button, I get the below error - 

HTTP Error 404.0 - Invalid navigation
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

It does not hit the 'Save' Action method. How can I get that working?

Thanks

Ivan Danchev
Telerik team
 answered on 23 Dec 2020
12 answers
348 views

While selecting an item from the dropdowntree control, items without children shows-up properly but those with child items don't have labels, including the child items. The <span class='k-in'> is empty, it is direct-child of <div class='k-bot'> which is under the <li role='treeitem'>.

I followed this example but omitted the second mapping because from the root parents to the children, they share the same structure. IEnumerable of my "TreeItem" class:

public class TreeItem<T>{

public T Item {get;set;}

public IEnumerable<TreeItem<T>> Children {get;set;}

public bool HasChildren {

get {

return this.Children != null && this.Children.Coun() > 0;

}

}

}

 

And here's how I configured the binding part:

@(Html.Kendo().DropDownTree()

.Name("Categories")

.BindTo(Model.CategoriesList, mapping => {

mapping.For<TreeItem<Category>>(binding => binding

.Children(c => c.Children)

.ItemDataBound((item, categ) => {

item.Expanded = true;

item.HasChildren = categ.HasChildren;

item.Id = categ.Item.Id;

item.Text = categ.Item.Name;

item.Value = categ.Item.Id.ToString();

})

)

})

.LoadOnDemand(false)

)

the Model.CategoriesList is IEnumerable<TreeItem<Category>> which makes it the same structure as the Children of the TreeItem<Category> in here, if it matters.

Petar
Telerik team
 answered on 22 Dec 2020
3 answers
72 views
Is there a way to open the upload dialog when a user drags and drops files, so that they can keep track of the files being uploaded and their status?
Ivan Danchev
Telerik team
 answered on 22 Dec 2020
3 answers
1.2K+ views

Hello,

 

I'm trying when exporting a Grid to excel file to format some columns raw content into hyperlink text. 

 

here is the implementation of my excelExport function:

 

01.function excelExport(e) {
02.        if (!exportFlag) {
03.            e.sender.showColumn(3);
04.            e.sender.showColumn(4);
05.            e.sender.showColumn(5);
06.            exportFlag = true;
07. 
08.            var sheet = e.workbook.sheets[0];
09.            var data = this.dataSource.view();
10. 
11.            for (var i = 0; i < data.length; i++) {
12.                sheet.rows[i + 1].cells[3].formula = "=HYPERLINK(" + data[i].LinkExportPdf + ", Export Pdf " + data[i].Id + ")";
13.                sheet.rows[i + 1].cells[4].formula = "=HYPERLINK(" + data[i].LinkExportPpt + ", Export Ppt " + data[i].Id + ")";
14.            }
15.            e.preventDefault();
16. 
17.            setTimeout(function () {
18.                e.sender.saveAsExcel();
19.            });
20.        } else {
21.            e.sender.hideColumn(3);
22.            e.sender.hideColumn(4);
23.            e.sender.hideColumn(5);
24.            exportFlag = false;
25.        }
26.    }

 

What i tried to do first is to assign direct the value by changing the cell value which doesn't provide any result, 2nd problem, when debugging the columns 3, 4 and 5 aren't into my sheet object even with the showColumn and when downloading the excel file, like any of the operation above isn't take in consideration.

 

My Grid set Events like this:

1..Events(e =>
2.{
3.     e.DataBound("dataBound");
4.     e.ExcelExport("excelExport");
5.})

 

The excel setting is like this:

 

1..Excel(excel => excel
2.       .FileName("ExcelFileName.xlsx")
3.       .AllPages(false)
4.       .ProxyURL(Url.Action("BackOfficeExportFunction", "Grid"))
5.)

 

Thanks in advance for your help !

Tsvetomir
Telerik team
 answered on 22 Dec 2020
15 answers
723 views

Hi,

I have a kendo MVC grid with incell edit mode.

when i click  add new record and in new record row i have a autocomplete , cascading dropdown and normal dropdowns.

when i select values in first column and after move to second column then first column values are disappearing and again when i click on first column then values are showing in first column.

Ivan Danchev
Telerik team
 answered on 22 Dec 2020
1 answer
11.4K+ views

 I am using MVC Kendo UI. I have defined my grid in Razor

 

@(Html.Kendo().Grid<BatchDetails>()
    .Name("Grid")
    .Columns(col =>
    {
        col.Bound(p => p.BatchDetailID)
            .ClientTemplate("<input class='chkbox' type='checkbox' value='#=BatchDetailID#' />")
            .HeaderTemplate("<input type='checkbox' id='selectAll' />")
            .Width(30)
            .Sortable(false)
            .Filterable(false);
        col.Bound(p => p.BatchKey).Title("State");
        col.Bound(p => p.OriginalCost).Title("Total Cost");
    })
            .AutoBind(true)
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(20)                   
                .Read(read => read
                    .Action("GetData", "Home", new { batchID = Model.BatchID })))
)

 

  1> I want to bind DataBound event of the grid in document ready function.
 but when i do that i get null reference.
 

$function({
 var grid = $("#Grid").data("kendoGrid"); // grid variable is null here
 grid.bind("dataBound", function(){
  //dosomething here
 });
})

 
 
 2>If i bind the event using the following approach then i have to declare the onDataGridBound function as Global. The Grid cannot access scoped function
 
  @(Html.Kendo().Grid<BatchDetails>()
      .Name("Grid")                       
.Events(x => x.DataBound("onDataGridBound"))               
  )

 is there any way to declare onDataGridBound as scoped function, and grid can still access it?

 

Petar
Telerik team
 answered on 22 Dec 2020
12 answers
2.7K+ views
Hi,

@(Html.Kendo().Grid(Model.Products)
    .Name("FabricGrid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Fabric).ClientFooterTemplate("Fabric Count: #=count#");
        columns.Bound(p => p.Pattern);       
        columns.Bound(p => p.UPrice).Format("{0:c}");
        columns.Bound(p => p.Qty).Width(120).ClientFooterTemplate("Total :").Format("{0:0.00}");
        columns.Bound(p => p.Total).ClientTemplate("#= kendo.format('{0:c}', Qty * UPrice) #").ClientFooterTemplate("#= kendo.format('{0:c}', sum)#");
 
        columns.Command(command => command.Edit()).Width(110);
        columns.Command(command => command.Destroy()).Width(110);
    })
    .Scrollable()
    .Sortable()   
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .DataSource(dataSource => dataSource
        .Ajax()
        .ServerOperation(false)
        .Aggregates(aggregates =>
        {
            aggregates.Add(p => p.Fabric).Count();
            aggregates.Add(p => p.Total).Sum();
        })
        .Model(model => model.Id(p => p.ProductId))
        .Events(events => events.Error("error_handler"))
        .Update(update => update.Action("Product_Update", "ShoppingCart"))
        .Destroy(destroy => destroy.Action("Product_Delete", "ShoppingCart"))
    )
)

I have the above grid which displays the total price of the order in the grid's footer.  The footer total is updated automatically when I delete a row.  When I edit a row and change the value in the qty column, the row total column is updated correctly ClientTemplate("#= kendo.format('{0:c}', Qty * UPrice) but the footer total does not change .ClientFooterTemplate("#= kendo.format('{0:c}', sum)#").

Also, how do you justify the column display?  I want the numbers to be right justified to they all lineup like in excel.

thanks
Anton Mironov
Telerik team
 answered on 21 Dec 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?