Telerik Forums
UI for ASP.NET MVC Forum
1 answer
234 views

Hi, I would like to have an AGENDA view but as all my events are always all day events so I don't need the time column. But I do have a field that stores a person's name that a particular event is assigned to. Can this be displayed. The display I want would look something like attached file

Georgi Krustev
Telerik team
 answered on 22 Jan 2016
3 answers
1.1K+ views

Hi,

I have a kendo tabstrip in which I want to know if its content is loaded or not in event Select. The tabstrip is defined as

        <% Html.Kendo().TabStrip()
            .Name("TabStrip")
            .Items(tabstrip =>
            {
                tabstrip.Add()
                    .Text(OTP.Ring.Models.ViewModel.EvaluationsLocalization.EvaluationForm_Tab_Overall)
                    .Content(() =>
                    {
                        %>
                            <div style="height: 400px"></div>
                        <%  
                    });
            })
            .Items(tabstrip =>
            {
                tabstrip.Add()
                    .Text(OTP.Ring.Models.ViewModel.EvaluationsLocalization.EvaluationForm_Tab_Coaching)
                    .Content(() =>
                    {
                    });
            })
 ...
            .Events(e => e.Select("onTabSelect")
                          .Activate("onTabLoad")
                          )
            .SelectedIndex(Model.SelectedTabIndex)
            .Render();            %>       

 

        function onTabSelect(e) {
            var content = $(e.contentElement);

            var index = $(e.item).index();            

...
        }

I tried $(e.contentElement).html(), but it is undefined. I am not sure how to get the content. The intent is that if the selected tab is already loaded before, then it won't be loaded again. Thanks.

Venelin
Telerik team
 answered on 22 Jan 2016
2 answers
119 views

Anyone know why my MobileModalView form appears for a split second on my page load? It's a stripped down version with no style, but it appears and then goes away. I modified the ModalMobileView demo to test the basics of the MobileModalView feature and included a form and some a few other small changes. Could the addition of a form cause this some how?

Here's my cshtml:

 @{

    Layout = "~/Views/Shared/_LayoutMobile.cshtml";

}


@model MyProjectWeb.Models.LoginModel




@(Html.Kendo().MobileView()
        .Name("modalview-camera")
        .Title("MyProject")
        .Content(
        @<text>

            <img src="@Url.Content("~/Content/photos/NewLogoTrimmed.JPG")" class="camera-image" style="width: 100%; height: 100%;" />
<br/>
<br />
<br />
<br />
<br />
<br />
            @(Html.Kendo().MobileButton()
                        .Text("Login")
                        .Name("modalview-open-button")
                        .Rel(MobileButtonRel.ModalView)
                        .Url("#modalview-login")
            )
        </text>)
)

@(Html.Kendo().MobileModalView()
       .Name("modalview-login")
       .HtmlAttributes(new { style = "width: 95%; height: 18em;" })
       .Header(obj =>
           Html.Kendo().MobileNavBar()
                .Content(navbar =>
                    @<text>
                        <span>Login</span>
                        @(Html.Kendo().MobileButton()
                            .Text("Cancel")
                            .Align(MobileButtonAlign.Right)
                            .Events(events => events.Click("closeModalViewLogin"))
                        )
                    </text>)
        )
        .Content(
        @<text>
            @ModalViewContentTemplate()
        </text>)
)

@helper ModalViewContentTemplate()
{
    using (Html.BeginForm("LogOn", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) {

        
        
    @(Html.Kendo().MobileListView().Style("inset")
                .Items(items =>
                {
                    items.Add().Content(
                        @<text>
                            @Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })
                            @Html.TextBoxFor(m => m.UserName, new { @class = "form-control" })
                            @Html.ValidationMessageFor(m => m.UserName, "", new { @class = "text-danger" })
                        </text>);
                    items.Add().Content(
                        @<text>
                            @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
                            @Html.PasswordFor(m => m.Password, new { @class = "form-control" })
                            @Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" })
                        </text>);
                    items.Add().Content(
                        @<text>
                            <input class="k-checkbox" data-val="true" data-val-required="The Remember Me field is required." id="IsPersistent" name="IsPersistent" type="checkbox" value="true">
                            <label class="k-checkbox-label" for="IsPersistent">Remember Me</label>
                            <input name="IsPersistent" type="hidden" value="false">
                        </text>);
                })
        )
    
        @(Html.Kendo().MobileButton()
                    .Text("Login")
                    .Name("modalview-login-button")
                    .Events(events => events.Click("closeModalViewLogin"))
        )
        @*@(Html.Kendo().MobileButton()
                    .Text("Register")
                    .Name("modalview-reg-button")
                    .Events(events => events.Click("closeModalViewLogin"))
        )*@
        
    }
}
<style>


    #modalview-login-button,
    #modalview-reg-button,
    #modalview-open-button {
        display: block;
        text-align: center;
        margin: .6em .8em 0;
        font-size: 1.2em;
    }

    #modalview-open-button {
        margin: 0 3em;
        padding: .5em;
    }

    .km-flat #modalview-open-button {
        color: #fff;
    }

    #modalview-camera {
        text-align: center;
    }

        #modalview-camera img {
            display: block;
            margin: 30px auto;
        }

        #modalview-camera .km-content,
        .km-ios #modalview-login .km-content {
            /*background: url(../../content/shared/images/patterns/pattern1.png) repeat 0 0;*/
        }

    .km-ios #modalview-camera .km-button,
    .km-ios #modalview-login .km-button,
    .km-ios #modalview-camera .km-navbar,
    .km-ios #modalview-login .km-header {
        background-color: #000;
    }

        .km-ios #modalview-camera .km-button:active,
        .km-ios #modalview-camera .km-state-active,
        .km-ios #modalview-login .km-button:active,
        .km-ios #modalview-login .km-state-active {
            background-color: #2e2e2e;
        }

    .km-ios #modalview-login #modalview-login-button,
    .km-flat #modalview-login #modalview-login-button {
        background-color: Green;
        color: #fff;
    }

    .km-tablet .km-ios #modalview-camera .km-view-title, .km-tablet .km-ios #modalview-login .km-view-title {
        color: #fff;
        text-shadow: 0 -1px rgba(0,0,0,.5);
    }
</style>

<script>
    function closeModalViewLogin() {
        $("#modalview-login").kendoMobileModalView("close");
    }
</script>

 

The _LayoutMobile is here:

<!DOCTYPE html>

<html>
<head>


    <title>@ViewBag.Title</title>


    <link href="~/Content/kendo/2015.2.805/kendo.mobile.all.min.css" rel="stylesheet" />
    <link href="~/Content/kendo/2015.2.805/kendo.common.min.css" rel="stylesheet" />
    <link href="~/Content/kendo/2015.2.805/kendo.default.min.css" rel="stylesheet" />
    
    

    @*<link href="~/Content/kendo/2015.2.805/kendo.mobile.ios.min.css" rel="stylesheet" />*@

    @*<link href="~/Content/kendo/2015.2.805/kendo.mobile.android.light.min.css" rel="stylesheet" />*@
    @*<link href="~/Content/kendo/2015.2.805/kendo.mobile.flat.min.css" rel="stylesheet" />*@

    @*<link href="~/Content/kendo/2015.2.805/kendo.mobile.ios.min.css" rel="stylesheet" />*@

    <script src="~/Scripts/kendo/2015.2.805/jquery.min.js"></script>
    <script src="@Url.Content("~/Scripts/kendo/2015.2.805/kendo.all.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo/2015.2.805/kendo.aspnetmvc.min.js")"></script>

    <script type="text/javascript" src="@Url.Content("http://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js")"></script>
    <script type="text/javascript" src="@Url.Content("http://ajax.aspnetcdn.com/ajax/mvc/5.1/jquery.validate.unobtrusive.min.js")"></script>


    @*<script src="~/Scripts/jquery.timeago.js" type="text/javascript"></script>*@
    <script src="~/Scripts/moment-with-locales.js" type="text/javascript"></script>
    @*<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/kendo/2015.2.805/kendo.common.min.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/kendo/2015.2.805/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/kendo/2015.2.805/kendo.default.min.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/kendo/2015.2.805/kendo.dataviz.default.min.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/kendo/2015.2.805/jquery.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo/2015.2.805/kendo.all.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo/2015.2.805/kendo.aspnetmvc.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>*@
    @RenderSection("HeadContent", false)

    @*using the bundles instead*@
    @*@Styles.Render("~/Content/test.css")*@

    @*@Scripts.Render("~/bundles/bootstrap")
    @Styles.Render("~/Content/css")*@

    @(Html.Kendo().MobileApplication()
        //.PushState(true)
        .ServerNavigation(true)
        //.Root("/mobile/")
        //.StatusBarStyle("black")
    )
</head>
<body>
  

    
    @RenderBody()

</body>
</html>

Petyo
Telerik team
 answered on 21 Jan 2016
2 answers
327 views

I have implemented a hierarchy grid, and I would like to implement an event to launch a kendowindow on doubleclick of the subgrid.

 

Since the grid is named dynamically "grid_[ID OF ITEM]" I am not sure how to grab the row in script like I would if I knew the grid name.

$('#grid_#=CustomerCode# table tr').live('dblclick', function () {
           // code
  }); 

does not work,and I assume because I cant shove that type of name into JS as it is an asp element. How would I write that query correctly?

Kevin
Top achievements
Rank 1
 answered on 21 Jan 2016
5 answers
183 views
Hi,

I would like to use the Map control to display an overlay of our building layout. That is, I have an image of our offices, cubes, floors, etc. and I would like to use that with the map control, including zooming in/out.

Is there an example of doing that or some documentation explaining the process?
T. Tsonev
Telerik team
 answered on 21 Jan 2016
1 answer
127 views

Hello,

I need to set stroke color of individual connections between shapes depending on Model data from Controller.

 Is that possible with Html.Kendo() helper?

 

.DataSource(d => d
        .Read(read => read.Action("_SomeDiagram", "Diagram"))
        .Model(m => {
            m.Children("Entities");
            m.Id("Name"); }))  
.ConnectionDefaults(c => c.Stroke(s => s.Color("#979797").Width(2)))

 

ViewModel structure is simple with one root entity and three children.

T. Tsonev
Telerik team
 answered on 21 Jan 2016
1 answer
98 views

I cant apply correct page size to exported pdf from kendo editor. Is it bug? Is there some solution at this situation? 

It always set page size to size of content

http://c2n.me/3t7fNrQ

 

Alexander Popov
Telerik team
 answered on 21 Jan 2016
1 answer
105 views
We have telerik version 2015.2.805 which was used for MVC4 application. Now we are migrating to MVC5. I checked in NuGet. There Telerik UI package is available only for MVC6. My question is if same 2015.2.805 can be used for MVC5? What code changes are needed to make them to work with MVC5? Also by going to properties of Kendo.mvc.dll,can we know what MVC version that is supporting or is there any other way to identify the MVC version being supported?
Sebastian
Telerik team
 answered on 21 Jan 2016
7 answers
454 views

I've noticed there's a small visual issue occurring while using the date picker when going up (clicking on the month name, clicking on the year number) or going down (clicking on the selected year, clicking on the selected month).

 

When you go up or down a level, the elements in opened window starts off at a size which is slightly larger than what it should be when it finishes loading, so then when the widget finishes loading, it "jumps" to thesmaller size.

 

This currently happens on all styling, but its the most pronounced when using the material theme (e.g. using the bootstrap theme will make the elements jump very slightly towards the bottom).

 

Is there a way to stop this from happening?

 

Thanks

Dimo
Telerik team
 answered on 21 Jan 2016
2 answers
157 views

Hello everybody,

I have a TreeList, which displays Data from an external DataSource. I asked my self, how I can access the filter by a textbox. I tried alot, but nothing of that worked. Is there any way to do this?

 This is what i got so far:

LogEntryView:

02.<div class="form-group">
03.        @(Html.Kendo().TextBox()
04.            .Name("tree-text-search")
05.        )
06.        @(Html.Kendo().Button()
07.            .Name("Search")
08.            .Content("Search")
09.            .Events(e => e.Click("onClick"))
10.        )
11.</div>
12.@(Html.Kendo().TreeList<HrLaborRelation.Web.Models.LogEntryViewModel>()
13.    .Name("Entries")
14.    .Columns(columns => {
15.        columns.Add().Field(f => f.EntityName);
16.        columns.Add().Field(f => f.SpecifiedType);
17.        columns.Add().Field(e => e.ColumnName);
18.        columns.Add().Field(e => e.NewValue);
19.        columns.Add().Field(e => e.OldValue);
20.        columns.Add().Field(e => e.Action);
21.        columns.Add().Field(e => e.CreatedBy);
22.        columns.Add().Field(e => e.EntryDate).Format("{0:dd/MM/yyyy HH:mm}");
23.    })
24.    .Resizable(true)
25.    .Reorderable(true)
26.    .ColumnMenu()
27.    .Filterable(true)
28.    .DataSource(dataSource => dataSource
29.        .Read(read => read.Action("GetEntries", "LogEntry"))
30.        .Model(m => {
31.            m.Id(f => f.LogEntryId);
32.            m.ParentId(f => f.ParentLogEntryId);
33.            m.Field(f => f.EntityName);
34.        })
35.    )
36.)
37.//I actually don't really know what this does
38.function onClick(e) {
39.        alert("Click");
40.        var treeview = $("#Entries").data("kendoTreeView"),
41.        searchContext = $("#tree-text-search").val()
42.        alert(searchContext)
43.        item = treeview.findByText(searchContext),
44.        dataItem = treeview.dataItem(item),
45.        nodeText = dataItem.EntityName;
46. 
47.        alert(nodeText);
48.        while (dataItem.parentNode()) {
49. 
50.            alert("Iterating");
51.            dataItem = dataItem.parentNode();
52.            dataItem.children.filter({ field: "EntityName", operator: "contains", value: nodeText });
53.            nodeText = dataItem.text;
54.        }
55.}

LogEntryController:

01.namespace HrLaborRelation.Web.Controllers
02.{
03.    public class LogEntryController: BaseController {
04. 
05.        // GET: LogEntry
06.        public ActionResult Index() {
07.            return View(db.LogEntries.Where(x => x.EntityId == -1).ToList());
08.        }
09.        public JsonResult GetEntries([DataSourceRequest]DataSourceRequest request, int? id, /*string searchText*/) {
10. 
11.            var entries = db.LogEntries.Include(e => e.ColumnLogEntries);
12.            if (id.HasValue) {
13.                entries = entries.Where(e => e.ParentLogEntryId == id);
14.            }
15.            //if(!string.IsNullOrEmpty(searchText)) {
16.            //    entries = entries.Where(e => e.EntityName.Contains(searchText));
17.            //}
18.            var result = entries.ToList().Select(e => new LogEntryViewModel(e, e.ColumnLogEntries.Any()));
19. 
20.            return Json(result.ToTreeDataSourceResult(request), JsonRequestBehavior.AllowGet);
21.        }
22.    }
23.}

Thanks for your help.

 Kind regards 

 Brian Haller

Brian
Top achievements
Rank 1
 answered on 21 Jan 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
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?