Telerik Forums
UI for ASP.NET MVC Forum
1 answer
328 views
Any ideas? I took a stab in the dark; just add
'disabled' class to the template, but this doesn't work:

01.if (User.Identity.IsAuthenticated)
02. {
03.    <script type="text/x-kendo-tmpl" id="template">
04.        <div class="post-view k-widget">
05.            <div class="edit-buttons">
06.                <a class="k-button k-button-icontext k-edit-button" href="\\#"><span class="k-icon k-edit"></span></a>
07.                <a class="k-button k-button-icontext k-delete-button" href="\\#"><span class="k-icon k-delete"></span></a>
08.            </div>
09.            <div class="post-header bg-azure">
10.                <p class="post-title">#:Name# </p>
11.                <p class="post-time">#:kendo.toString(CommentDate,'d')#</p>
12.            </div>
13.            <div class="post-msg">
14.                #=Comment#
15.            </div>
16.        </div>
17.    </script>
18. }
19. else
20. {
21.    <p>You must be logged in to contribute.</p>
22.     
23.    <script type="text/x-kendo-tmpl" id="template">
24.        <div class="post-view k-widget">
25.            <div class="edit-buttons">
26.                <a class="k-button k-button-icontext k-edit-button disabled" href="\\#"><span class="k-icon k-edit"></span></a>
27.                <a class="k-button k-button-icontext k-delete-button disabled" href="\\#"><span class="k-icon k-delete"></span></a>
28.            </div>
29.            <div class="post-header bg-azure">
30.                <p class="post-title">#:Name# </p>
31.                <p class="post-time">#:kendo.toString(CommentDate,'d')#</p>
32.            </div>
33.            <div class="post-msg">
34.                #=Comment#
35.            </div>
36.        </div>
37.    </script>
38. }
39.}


What would be the correct way?

Thanks


Dimiter Madjarov
Telerik team
 answered on 01 Aug 2014
2 answers
230 views
I am trying to setup a panel bar to open when clicked and closed when clicked again. I have tried everything I know to do and have tried the panelBar animation sample with the if statements but for some reason couldn't make it work. Can anyone tell me what I'm doing wrong? Here is my code:

<div id="organizer">
        @(Html.Kendo().PanelBar()
     .Name("panelBar")
     .Animation(true)
      
     .ExpandMode(PanelBarExpandMode.Single)
     .Items(PanelBar =>
         {
             PanelBar.Add()
                 .Expanded(false)                         
                 .Content(@<div>
                    <div class="col-md-5">
                        <div class="panel-body">
                            <div id="employeeInfo">
                                <dl class="dl-horizontal">
                                    <dt>Office:</dt>
                                    <dd>Asheville, NC</dd>
                                    <dt>Department:</dt>
                                    <dd>FTG</dd>
                                    <dt>Position:</dt>
                                    <dd>Manager</dd>
                                    <dt>Phone: </dt>
                                    <dd>336-822-4442</dd>
                                    <dt>Email: </dt>
                                    <dd>victor.canipe@dhgllp.com</dd>
                                </dl>
                            </div>
                        </div>
                    </div>
                    <div class="myTable">
                        <div class="table-responsive">
                            <table class="table table-bordered table-condensed" style="margin-bottom:0px;">
                                <tr>
                                    <th>Skills</th>
                                    <th>Industries</th>
                                    <th>Services</th>
                                </tr>
                                <tr>
                                    <td>Language</td>
                                    <td>Lorem Ipsum</td>
                                    <td>Lorem Ipsum</td>
                                </tr>
                                <tr>
                                    <td>Technology</td>
                                    <td>JAVA</td>
                                    <td>JAVA</td>
                                </tr>
                                <tr>
                                    <td>Technology</td>
                                    <td>Access</td>
                                    <td>Access </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="panel-footer">
                        <div class="col-md-2 col-md-push-6">
                            <a id="more"><i class="fa fa-info-circle"></i>More</a>
                        </div>
                    </div>
                </div>
                 );
          })
        )
    </div>
Kamen Bundev
Telerik team
 answered on 01 Aug 2014
6 answers
342 views
I am having an issue creating a template for the Scheduler. What I am trying to do is set the event style class to one of four classes depending on the value of a given eventstate value from the model.  here is what I have for my whole kendo mvc schelduer with template. Can someone help show me how to write the template so it can do this and be in a valid state.

                @(Html.Kendo().Scheduler<SBAS_Web.Models.AppointmentModel>()
                      .Name("scheduler")
                      .Date(new DateTime(startdate.Year, startdate.Month, startdate.Day))
                      .StartTime(new DateTime(startdate.Year, startdate.Month, startdate.Day, 8, 00, 00))
                      .ShowWorkHours(true)
                      .Views(views => views.DayView(day => day.Selected(true)))
                      .Editable(false)
                      .AllDaySlot(false)
                      .EventTemplate(
                      "<div class='appointment-template  # if(AppointmentState == 'Default'){# DefaultColor #}#  if(AppointmentState == 'Completed'){# CompletedColor #}#  if(AppointmentState == 'ReadyForInvoicing'){# ReadyForInvoicingColor #}#  if(AppointmentState == 'Invoiced'){# InvoicedColor #}#'>" +
                        "<p>" +
                            "#= kendo.toString(start, 'hh:mm') # - #= kendo.toString(end, 'hh:mm') #" +
                        "</p>" +
                        "<p>#= title #</p>" +
                     "</div>")
                      .Timezone("Etc/UTC")
                      .DataSource(d => d
                          .Model(m =>
                          {
                              m.Id(f => f.AppointmentId);
                              m.Field(f => f.Title).DefaultValue("No title");
                              m.RecurrenceId(f => f.RecurrenceID);
                          })
                          .Events(e => e.Error("error_handler"))
                          .Read("Appointments_Read", "Appointment")

                        //.Update("Appointments_Update", "Appointment")
                      )
                      .Group(grp => grp.Orientation(SchedulerGroupOrientation.Vertical))
                )
Georgi Krustev
Telerik team
 answered on 01 Aug 2014
1 answer
216 views
Hi,

I'm wondering if it's possible to separate the input from the icon picker in the DateTimePicker.  To be more clear, I want to use the input to enter the time and have the user select the date from the calendar (it's much quicker and easier to type times, and repetitive to type the date over and over again when it changes far less frequently).

Right now if I apply a format and mask to a DateTimePicker to only display the time and change it, the value reverts to today at whatever time I've entered.  I'm also not sure how I could perhaps hide the clock icon to save some space.

Thanks for any help you can provide,
Kevin
Georgi Krustev
Telerik team
 answered on 31 Jul 2014
2 answers
114 views
Hello,

I'm looking for some guidance on how to implement a page where the user can drag items from a treeview control on to a grid.
The constraints are:
Don't allow the tree to be reorganized via drag and drop function.
The tree is to be lazy loaded.

I've tried to implement this using the kendoDraggable (using a selector to identify the nodes on the treeView) and a kendoDropTarget (with the gird as the target) this allowed me to drag the items, however the drop event never fired on the kendoDropTarget.

I've tried to implement this using the treeView's DragAndDrop functionality, however I don't know how to retrieve the treeView node information from the parameter passed into the kendoDropTarget's drop event.

any suggestions?

thanks in advance
-bill
Bill
Top achievements
Rank 1
 answered on 31 Jul 2014
5 answers
188 views
I have modified the  filter-menu-customization example to perfor server side filtering based on the filter value. I created this action method:

public ActionResult FilterMenuCustomization_Titles([Bind(Prefix="filter[filters][0][value]")]string filterValue)
{
    var db = new SampleEntities();
    var employeeTitles = db.Employees
                           .Select(e => e.Title)
                           .Where(t => t.StartsWith(filterValue))
                           .Distinct();
    return Json(employeeTitles, JsonRequestBehavior.AllowGet);
}

This works fine, but the Bind attribute and the prefix string looks fragile to me. I'm pretty sure there should be a better way to perform the filterValue binding. I imagine there should be a IModelBinder for FIlterDescriptor, so that I could leverage the other aspects of the filter descriptor (starts with, equals, logic operator etc). But I failed to find it.

I posted my example here on Github.

Any suggestions?



Marijn
Top achievements
Rank 1
 answered on 31 Jul 2014
1 answer
78 views
I copied the ListView example - and each time I edit a record, the save and cancel buttons are somehow obscured from view so I can never save.


However I define my EditorTemplate, whenever I edit my record, the same thing happens...

How can you 'control' your controls to stay nicely in the 'record box' like when you're just viewing the records?
Eric
Top achievements
Rank 2
 answered on 30 Jul 2014
1 answer
120 views
Hi,
I'm following the example "binding markers to remote data"
My question is: is it possible to center the map programmatically after the Datasource.read is being called? My datasource contains a list of possible stores. However, I would like to center the map (add a marker) with the initial longitude/latitude of my search request?

Next question : would it be possible (after datasource.read) to center/zoom the map around that layer?

So my code looks more or less as follow:
 @(Html.Kendo().Map()
    .Name("map")
    .Zoom(3)
    .Layers(layers =>
    {
        layers.Add()
            .Type(MapLayerType.Tile)
            .UrlTemplateId("http://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png")
            .Subdomains("a", "b", "c")
            .Attribution("&copy; <a href='http://osm.org/copyright'>OpenStreetMap contributors</a>");

        layers.Add()
            .Type(MapLayerType.Marker)
            .DataSource(dataSource => dataSource
                  .Read(read => read.Action("_StoreLocations", "Order", new { OrderId = Request.QueryString["OrderId"] }))
                  )
            .LocationField("LatLng")

            .TitleField("Name");

    })
Hristo Germanov
Telerik team
 answered on 30 Jul 2014
1 answer
97 views
Is it possible to show inline editable grid in popup editor of parent grid?
There is no success so far - popup window is not showing up but it is showed inline and parent table layout is broken.

Similar question can be found here: 
http://www.telerik.com/forums/editable-grid-in-a-grid-s-popup-editor
http://stackoverflow.com/questions/13402092/editable-grid-in-a-grids-popup-editor
Nikolay Rusev
Telerik team
 answered on 30 Jul 2014
2 answers
168 views
I'm using the MVC TreeView and I'm binding to a datasource as below:

@(Html.Kendo().TreeView()
        .Name("tvDocumentDirs")
        .DataTextField("Name")
        .DataSource(dataSource => dataSource
            .Model(m => m.Id("Path").HasChildren("HasChildren"))
            .Read("ReadDirectoryGetDirs", "Documents").Events(e=>e.RequestEnd("tvDocumentDirs_onRequestEnd").Error("tvDocumentDirs_onError"))
        )
        .Events(events => events
          .Select("tvDocumentDirs_onSelect")
          .Change("tvDocumentDirs_onChange")
        )
    )


The .Read("ReadDirectoryGetDirs", "Documents") - everything works fine. However in the controller action if any error occurs the TreeView hangs (waits indefinitely) what I want to do is handle any errors in the controller action return the error to page, handle the error and then cancel the databind on the treeview. Is it possible to cancel the databind for the treeview?
Petur Subev
Telerik team
 answered on 30 Jul 2014
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?