Telerik Forums
UI for ASP.NET MVC Forum
1 answer
128 views
Can the edit function for the MVC Scheduler be changed from a double click to a single click event?
Bozhidar
Telerik team
 answered on 18 May 2016
3 answers
236 views
How do I drag and drop between two TreeLists?
Alex Gyoshev
Telerik team
 answered on 17 May 2016
1 answer
138 views

I have a page where the update is put in motion using a custom button click that resides in the Kendo Toolbar.

The editing is done using GridEditMode.InCell and everything is working for the update but at the end of the process the little red triangle is remaining in the modified cells.

 

I have tried the following to clear them but it is not working:

....
grid.dataSource.read();
resetGridDirtyIndicators();
...

function resetGridDirtyIndicators (){
             
            var grid = $('#Grid').data().kendoGrid;
            var $gridData = grid.dataSource.data();
 
            for (var i = 0; i < $gridData.length; i++) {
                
                var row = grid.tbody.find("tr[data-uid='" + $gridData[i].uid + "']");
                var cell = row.find("td:eq(" + $gridData[i].ColumnIndex + ")");
 
                if (cell.hasClass("k-dirty-cell")) {
                    debugger;
                cell.removeClass("k-dirty-cell");
            }
          }
        }

 

Any Help would be greatly appreciated.

Thanks,

Reid

Radoslav
Telerik team
 answered on 17 May 2016
1 answer
52 views

Good day,

In the spreadsheet control any time you type a string that resembles a date or time, the format for the cell changes to Date.

For instance, if you go to the DataSource Binding demo at http://demos.telerik.com/aspnet-mvc/spreadsheet/datasource and type 10:00 PM in the ProductName column the current date will be displayed in the cell. If you type 10-10-10 it will be changed to 10/10/2010. If you type 10:99 it gets changed to 11:39.

So with a spreadsheet that is bound to a datasource. How do you force a column to keep the input string as a string?

Thanks and Regards

 

Bozhidar
Telerik team
 answered on 17 May 2016
2 answers
1.5K+ views

Hello,

 

My grid has a column called "vessel_idx" that shows all the IDs relating to each vessel(obviously), each row also has a button that calls my own Javascript function.  I need to pass the value of the vessel_idx into this function, does anyone know how I can accomplish this?

Here is my grid with the required column and button as described above.

@(Html.Kendo().Grid<MyProject.ViewModels.SpotGridViewModel>()
     .Name("Grid")
     .Deferred()
     .Columns(columns =>
     {
         columns.Bound(c => c.vessel_idx);
         columns.Template(@<text></text>)
             .ClientTemplate("<ul class='grid-options'>" +
                               "<input type='button' id='mybtn' value='Prompt' />"+   
                             "</ul>").Width(200);
     })
)

Here is my javascript code that I need to pass the vessel_idx into

$("#Grid").on("click", "#mybtn", function (e) {
     
    var id = vessel_idx;
 
            $.ajax({
                url: "@Url.Action("buttonPrompt", "Home")",
                type: "GET",
            data: { id: id },
            dataType: 'json',
            cache: false,
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert("Error" + errorThrown);
                console.log(errorThrown);
            },
            success: function (data) {
                console.log("yay");
            }
            });
    });

Many thanks

Allan
Top achievements
Rank 1
 answered on 17 May 2016
1 answer
414 views

I have two TreeViews which have drag and drop enabled. I am trying to limit the depth when someone tries to drag a branch to the other tree.

Example:

TreeA (root)

  TreeA.1.0 (child; level 1)

    TreeA.1.1 (child; level 2)

 

TreeB (root)

  TreeB.1.0 (child; level 1)

    TreeB.1.1 (child; level 2)

 

Given the above two trees and I desire to only have nodes up to 3 levels deep (ie. no deeper than child level 2) If a user drags "TreeB.1.0" under "TreeA.1.1" then TreeA will have children 4 levels deep.

I see events Drag and Drop which allow me to validate the destination tree to prevent this. I tried to implement custom data elements as HtmlAttributes in my OnDemand TreeViewItemModel DataSource in server-side code:

TreeViewItemModel node = new TreeViewItemModel();

...

node.HtmlAttributes.Add(new KeyValuePair<string, string>("data_level", level.ToString()));

 

This

 

Helen
Telerik team
 answered on 16 May 2016
1 answer
118 views

I'm looking to get the MultiSelect list to display something like "1 out of 15"  But when using the "maxTotal" found here tagTemplate, I get "maxTotal is not defined"

 

1.<script type="text/x-kendo-template" id="selectedRoleTemplate">
2.    #:data.length# out of #:maxTotal#
3.</script>
4.<script type="text/javascript">
5.    var selectedRoleTemplate = kendo.template($("#selectedRoleTemplate").html(), { useWithBlock: false });
6.</script>

 

01.@(Html.Kendo().MultiSelectFor(m => m)
02.      .AutoBind(true)
03.      .AutoClose(false)
04.      .DataValueField("RoleId")
05.      .DataTextField("RoleName")
06.      .TagMode(TagMode.Single)
07.      .TagTemplate("#=selectedRoleTemplate()#")
08.      .DataSource(dataSource =>
09.      {
10.          dataSource.Read(read => read.Action("UserRoleList", "Lov", new { userId = -9, isActiveOnly = false}))
11.              .ServerFiltering(false);
12.      }))

 

 

 

 

Hristo Valyavicharski
Telerik team
 answered on 14 May 2016
2 answers
232 views

Hi,

Is there a way to access scheduler resources inside the Event Template?

For instance:

Course Resource - List of courses with CourseID and CourseTitle.

Event Template - 

.EventTemplate(
        "<div style=color:#:setTextColor(data)#>" +
        "<h4>Course: #= CourseTitle # </h4>" +     
        "<h5>Class: #= title # </h5>" +
        "</div>"
    )

"<h4>Course: #= CourseTitle # </h4>"  would be returned by the foreign key ID from the viewModel record to the Course Resource primary key.

Chris
Top achievements
Rank 1
 answered on 13 May 2016
3 answers
465 views

I'm currently working on a .NET MVC app with one area, Inside, and then a single controller on the root area, Home.  What I'm noticing is something somewhat similar to what is discussed in this post; I have a Home controller in both my root and Inside areas, and when the menu attempts to render the links to the root actions while at an Inside url, such as /Inside/Account/Login, the links to any Home actions which are present in both the Inside and root areas are not rendered.  I noticed that if I take away the [Authorize] attribute on my Inside Home controller, the actions do render properly i.e. /Home/Index is rendered.  However, I want to make sure that my inside controllers are decorated with the Authorize attribute.

 

For example, with the following code snippet

// Root Home Controller
public class HomeController : Controller {
    // Doesn't render
    public ActionResult Index() { return View(); }
    // Doesn't render
    public ActionResult Contact() { return View(); }
    // Renders
    public ActionResult About() { return View(); }
}
 
// Inside Home controller
[Authorize]
public class Home : Controller {
    public ActionResult Index() { return View(); }
    public ActionResult About() { return View(); }
}
 
// /Inside/Account/Login View snippet
@(Html.Kendo().Menu().Name("MainMenu").Items(children =>
{
    items.Add().Text("Root Home").Action("Index", "Home", new { area = "" });
    items.Add().Text("Root Contact").Action("Contact", "Home", new { area = "" });
    items.Add().Text("Root About").Action("About", "Home", new { area = "" });
    items.Add().Text("Login").Action("Account", "Login", new { area = "Inside" });
}))

if I go to /Home/Index or /Home/Contact I get a menu the menu you would expect (as seen in Correct.png), whereas if I go to /Inside/Account/Login, I get a menu with only the About and Login buttons (as seen in Incorrect.png).  My guess is that the Telerik Menu rendering function is attempting to security trim [Authorize] decorated action links with identical names disregarding the area in which the action was specified.

I'm wondering if there is a better way around this bug than to decorate my Inside.Home.Index/Contact actions with [AllowAnonymous] and using a redirect to the root area if a user is not authenticated.

 

 

T. Tsonev
Telerik team
 answered on 13 May 2016
11 answers
666 views

Hi,

 

I am using MVC data annotation in the class (sample below) everything works ok but I am facing two issues
1. The class doesn't turn to "k-invalid" after submit click for the kendo comboboxm, therefore, I cannot set the css as red
2. The conbobox tooltip is behind another control, tooltip doesn't expand it like textbox

[Required(ErrorMessage = "Car Owner is required.")]
[Range(1, int.MaxValue, ErrorMessage = "This is invalid.")]
public int? CarOwnerId { get; set; }

Thank you!

Ianko
Telerik team
 answered on 13 May 2016
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
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
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?