Telerik Forums
UI for ASP.NET MVC Forum
1 answer
88 views
Hello,

I am stuck in one date picker selection. I want to select a date picker. When selection the date , I want to select the beginning of the date at the label. Like if i select 17 June 2014 which is Tuesday, I want to populate 16 June 2014 (Monday). Similarly, If i choose 19 June 2014(Thursday), I want to populate 16 June(Monday). Whatever date I pick, I want the Monday date to populate in the date picker label.
Kiril Nikolov
Telerik team
 answered on 19 Jun 2014
2 answers
665 views
Hi!

When I try to filter a column of type DateTimeOffset, I get an error like: "System.InvalidCastException: Invalid cast "System.DateTime" to quot;System.DateTimeOffset"."

Please tell me how to solve this problem. Thank you!
Aleksey 311
Top achievements
Rank 1
 answered on 18 Jun 2014
5 answers
177 views
Hi!

Is it possible to have a sparkline inside a listview HTML template?
If so, what is the best practice regardning binding it to data?

Regards,
Per
Iliana Dyankova
Telerik team
 answered on 18 Jun 2014
3 answers
79 views
Hello,

I have downloaded UI for ASP.NET MVC Q1 2014, and built a sample project
(unfortunately, i'm not able to attach project size more than 2MB)

On last page of the grid I get displace of headers and table contents:



Would be glad to receive your kind assistance

Shabtai
Dimo
Telerik team
 answered on 18 Jun 2014
1 answer
159 views
I have defined a DropDownListFor in my view as follows:
@(Html.Kendo().DropDownListFor(m=>m.BusinessUnitId)
 .OptionLabel("Select item...")
 .BindTo(new SelectList(Model.BusinessUnitList, "Key", "Value"))
)
where BusinessUnitList is a Dictionary<string, string> of value BusinessUnitIds and their descriptions.
Everything looks good on the screen and I can select a value and see its value via jQuery using: $("#BusinessUnitId").val()
However, when I try to submit the form, I get the following error:
System.ArgumentNullException
"Value cannot be null. Parameter name: items"
Alexander Popov
Telerik team
 answered on 18 Jun 2014
4 answers
660 views
I'm trying to get search results to display in a tooltip window.  I've got the tooltip working to pass my search text to my partial view, but it only works on the first call.  Every time the tooltip loads again, the results are the same, because the content is never reloaded.  Is there a way to not cache what comes back from the tooltips .LoadContentFrom function, so that I can pass new parameters back to the partial view each time?
Here is what I have for the tooltip.
What I'd like is that everytime the tooltip is show, the LoadContentFrom is called.
@(Html.Kendo().Tooltip()
    .For("#searchButton")   
    .LoadContentFrom("AllSearch", "Search", new { area = "" })   
    .ShowOn(TooltipShowOnEvent.Click)
    .Position(TooltipPosition.Bottom)
    .AutoHide(false)
    .Width(600)
    .Height(600)
    .Callout(true)
    .Animation(true)   
    .Events(e =>
        {
            e.RequestStart("requestStart");           
        })
)

<script>
    function requestStart(e) {
        var st = $("#searchText").val();
 
        e.options.data = {
            searchText: st
        }
    }
     
</script>
Rosen
Telerik team
 answered on 17 Jun 2014
4 answers
498 views
I have looked at similar postings but I am unable to figure it out. The json data is displaying as text, not through the view

CONTROLLER
[HttpPost]
        public JsonResult ReportsPhoneSupport([DataSourceRequest] DataSourceRequest request, ReportsPhoneSupport model)
        {
            string[] userIds = model.UserId.Split(',');
            ReportPhoneSupportResultTypedView results = new ReportPhoneSupportResultTypedView();
            foreach (string userId in userIds)
            {
                int iUserId = 0;
                if (Int32.TryParse(userId, out iUserId))
                {
                     
                    RetrievalProcedures.FetchReportPhoneSupportResultTypedView(results, model.FromDate, model.ToDate, iUserId);
                }
            }
            var Results = from Reslt in results
                          select new{
                              ActivityDate = Reslt.ActivityDate,
                              Action = Reslt.Action,
                              Assignment = Reslt.Assignment,
                              Description = Reslt.Description,
                              Result = Reslt.Result,
                              ToFrom = Reslt.ToFrom
                          };
            return Json(Results.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet);
             
        }
VIEW
@{
    ViewBag.Title = "ReportsPhoneSupport";
}
 
<h2>ReportsPhoneSupport</h2>
 
 
@(Html.Kendo().Grid<ZoomAudits.DAL.TypedViewClasses.ReportPhoneSupportResultRow>()
    .Name("grid")
     
    .Columns(columns =>
    {
        columns.Bound(m => m.ActivityDate).Format("{0:MM/dd/yyyy}").Title("Activity Date");
        columns.Bound(m => m.Assignment).Title("Assignment");
        columns.Bound(m => m.Action).Title("Action");
        columns.Bound(m => m.ToFrom).Title("ToFrom");
        columns.Bound(m => m.Result).Title("Result");
        columns.Bound(m => m.Description).Title("Description");
    })
     
    //.AutoBind(true)
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
     
    .DataSource(dataBinding => dataBinding
        .Ajax()
        .ServerOperation(false)
        .PageSize(20)
             
                .Read(read => read.Action("ReportsPhoneSupport", "ReportsPhoneSupport"))
     )
)
Example of displayed data 
{"Data":[{"ActivityDate":"\/Date(1398866129000)\/","Action":"Call Placed","Assignment":9538,"Description":"Spoke with insured, Krsto Djurovski (Chris),
Lee
Top achievements
Rank 1
 answered on 16 Jun 2014
1 answer
154 views
Hi,

We have a page with several combobox's and due to the delay from them all AutoBinding the page loads with the numeric value displaying inside the textbox and is only replaced by the text after the bind.  Is there a way to set an initial data binding while still attaching the read method to load server filtered alternatives via Ajax?  This way the page will display the text on load, and avoid multiple simultaneous ajax requests.

For example here is some failed code I've tried to give you some idea of what I would like.

@(Html.Kendo().ComboBoxFor(x => x.List[i].ID)
                            .DataTextField("Name")
                            .DataValueField("ID")
                            .Filter(FilterType.StartsWith)
                            .MinLength(3)
                            .BindTo(new List<ItemDTO>(){
                                new ItemDTO(){
                                    ID = Model.List[i].ID,
                                    Name = Model.List[i].Name
                                }
                            })
                            .AutoBind(false)
                            .DataSource(ds =>
                            {
                                ds.Read(r => r.Action("Action", "Controller").Data("filter")).ServerFiltering(true);
                            })
                            .Events(e => e.Change("Change"))
                    )

Thanks,
Kevin
Daniel
Telerik team
 answered on 16 Jun 2014
1 answer
106 views
When I generate a kendo control  thanks to Jquery, it is easy to select and put it in a javscript var  for doing stuffs on it
@section scripts
{
    <script>
        $(document).ready(function () {
 
              var slider = jQuery("#slider").kendoSlider({
                increaseButtonTitle: "Right",
                decreaseButtonTitle: "Left",
                showButtons: true,
                min: 1,
                max: 4,
                largeStep: 1,
                tooltip: {
                    enabled: false
                }
            });
 });
  </script>
}
 
<input id="slider" class="sliderClass" />
I would like to be able to select the same kendo control generated by the helper way, and put it  in javascript var but i can't manage to do it . Any ideas??????
@section scripts
{
    <script>
 
       var slider = $(".balSlider").kendoSlider; //want to select the kendo control and put it in a  var  but FAIL!!!
   </script>
}
 
 @(Html.Kendo().Slider()
                  .Name("titio")
                  .IncreaseButtonTitle("Right")
                  .DecreaseButtonTitle("Left")
                  .Min(0)
                  .Max(3)
                  .SmallStep(1)
                  .Value(0)
                           .Events(events => events
                      .Slide("sliderSlide")
                     )
                  .HtmlAttributes(new { @class = "balSlider" })
                ))
Sebastian
Telerik team
 answered on 16 Jun 2014
2 answers
119 views
Hello, 

I have been evaluating the grid and I cant seem to get the Create method to work , no reaction on the grid. The edit works fine, which is using the custom template. The grid is configured to work in the popup edit mode. 

Perhaps I am missing something small, but even the sample project that i downloaded from the code library (foreignkeydemo) doesnt work. 

I have followed the examples in the documentation to no avail. 

Here is the code below, i would appreciate if anyone can point me in the right direction or perhaps some documentation that i might have missed. 

Thanks in advance. 

Max. 

Index.cshtml. 

@using PMTrack   
 
    
<script type="text/kendo" id="memberTemplate">
        <ul>  
            #for(var i=0; i<data.length; i++){#
            <li> #:data[i].Firstname +" "+ data[i].Lastname #</li>
         #}#
          
        </ul> 
</script> 

<script type="text/javascript">
   var memberTemplate = kendo.template($("#memberTemplate").html(), {useWithBlock:false})
</script>

@(Html.Kendo().Grid<Project>()
      .Name("grid")
      .Columns(columns =>
          {
              columns.Bound(p => p.Id).Width(5).Title("#").Filterable(false);
              columns.Bound(p => p.Name).Width(60).Title("Project name");
              columns.Bound(p => p.StartDate).Width(50).Filterable(true).Format("{0:dd/MM/yyyy}");
              columns.Bound(p => p.PlannedEndDate).Width(50).Format("{0:dd/MM/yyyy}");
              columns.Bound(p => p.Status).Width(20);
              columns.Bound(p => p.Members).ClientTemplate("#=memberTemplate(Members)#").Width(100);
              columns.Bound(p => p.Owner.Firstname).ClientTemplate("#=Owner?Owner.Firstname:''#").Title("Owner").Width(50);
              columns.Command(command =>
                  {
                      command.Edit();
                      command.Destroy();
                      

                  }).Width(40); 
                                                                                                                                                          
          } )
      .ToolBar(toolbar =>  toolbar.Create().Text("New Project"))
      .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("ProjectEditorTemplate"))
      .Pageable()
      .Sortable()
      .HtmlAttributes( new { style="width:900px"})
      .Filterable()
      .DataSource(ds => ds.Ajax().Events(e => e.Error("onError"))
                          .PageSize(20)
                          .Model(model => model.Id(p =>p.Id))
                          .Read(read => read.Action("Read", "Home"))
                          .Update(update=> update.Action("Update", "Home"))
                          .Destroy(destroy => destroy.Action("Delete", "Home"))
                          .Create(create => create.Action("Insert", "Home").Type(HttpVerbs.Post))
      ))
  
<script type="text/javascript">
    function onError(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    }
</script>



<script>
    $(document).ready(function () {
        kendo.culture("en-GB");

    });
</script>


The Controller : 
public ActionResult Read([DataSourceRequest] DataSourceRequest request)
        {

            var ps = new ProjectService();


            return Json(ps.Read().ToDataSourceResult(request));

        }
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Update([DataSourceRequest] DataSourceRequest request, Project project)
        {
            if (project != null && ModelState.IsValid)
            {
                var ps = new ProjectService();
                ps.Update(project);

            }
            return Json(new[] { project }.ToDataSourceResult(request, ModelState));
        }

        public ActionResult Delete([DataSourceRequest] DataSourceRequest request, Project project)
        {
            if (project != null)
            {
                var ps = new ProjectService();
                ps.Delete(project);
            }

            return Json(new[] { project }.ToDataSourceResult(request, ModelState));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Insert([DataSourceRequest] DataSourceRequest request, Project project)
        {


            if (project != null && ModelState.IsValid)
            {
                var ps = new ProjectService();
                ps.Create(project);
            }


            return Json(new[] { project }.ToDataSourceResult(request, ModelState));
        }


        public ActionResult Index()
        {
            var ms = new MemberService();

            var members = ms.GetAll();

            var status = new List<string>
                {
                    "Development",
                    "Validation"
                };


            ViewData["status"] = status;

            ViewData["owners"] = members;

            ViewData["members"] = members;

            return View();
        }








Max
Top achievements
Rank 1
 answered on 16 Jun 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?