Telerik Forums
UI for ASP.NET MVC Forum
9 answers
844 views
I have a view model like:
1.public class MyViewModel
2.{
3.    public string PhoneModel { get; set; }
4.}

That is currently rendered on my view as:
1.@model MyViewModel
2. 
3.@Html.EditorFor(model => model.PhoneNumber)

With yesterday's official release of the MaskedTextBox control, I am attempting to update my view to use it instead like:
1.@model MyViewModel
2. 
3.@(Html.Kendo().MaskedTextBoxFor(model => model.PhoneNumber).Mask("(999) 000-0000"))

Unfortunately, VS is complaining "Cannot implicitly convert type 'string' to 'int?'" and the view throws the same compilation error.

Looking at the following WidgetFactory metadata, the MaskedTextBoxFor is trying to return its value as an int?
1.//
2.// Summary:
3.//     Creates a new Kendo.Mvc.UI.MaskedTextBox.
4.public virtual MaskedTextBoxBuilder MaskedTextBoxFor(Expression<System.Func<TModel, int?>> expression);

Phone numbers are typically too big of numbers to be represented by int, not that I would want to incur the overhead of doing so even if it was possible.  Are there any plans to update the helper to return the model's data type rather than hard-coding the return type to int? ?
Georgi Krustev
Telerik team
 answered on 02 Oct 2014
5 answers
135 views
See Attachment, the paging inside the grid of the child somehow goes to the new line for Refresh.  I have  grid which has a child grid, the child grid paging is showing double line.  This paging is fine for IE and Chrome.
Vladimir Iliev
Telerik team
 answered on 02 Oct 2014
4 answers
153 views
Hi Telerik,

I have this requirement that I want to load the details of my a row using your clientemplateid.
I already created my template and it is a kendo tabstrip. it has an item loaded from a partial view here is the code

@(Html.Kendo().TabStrip()
            .Name("tabStrip_#=RowID#")
            .SelectedIndex(0)
            
            .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
            .Items(items =>
            {

                items.Add().Text("Profile Information")
                    .LoadContentFrom("GetPartialApplicantProfile", "SearchProfile", new { rowid = "#=RowID#" })
                    .Selected(true);
                
            })
            .Events(s => s.ContentLoad("DetailLoaded"))
            .ToClientTemplate())

the problem with this is on the initial load of the template when i expand a row it displays the detail perfectly. And after a second the next row below it overriding the display of the template. Why is that happening? Is it the row doesnt detect the size of my template when i loaded it partially?



Mhars
Top achievements
Rank 1
 answered on 02 Oct 2014
1 answer
85 views
Okay so lets try to explain what situation I'm correctly involved in.

I have a Kendo().Grid<>  that is bound to a Dependant Model.

I have a EditorTemplate of the fields required for the editing of this Grids columns within a Popup window. This template has a few dropdowns that get populated with a remote datasource. The normal textboxes updates the model within the grid while the dropdown simply refuses to do so.

I already tried the ValuePrimitive but to no Avail.

Help Please
Nikolay Rusev
Telerik team
 answered on 01 Oct 2014
1 answer
128 views
In my scheduler, I have, as a part of the definition:

.EventTemplate(
       "<p>" +
       "#= kendo.toString(start, 'MMM dd yyyy hh:mm t') # (#= kendo.toString(new Date(end.getTime()-start.getTime()).getHours()) #) #= title#" +
        "</p>")
 

then this runs, I get 

<p>Sep 29 2014 12:00 t (20) Smith, John</p>


20 hours is the value I get for a one hour meeting.
21 hours is the value I get for a two hour meeting.

I would have expected 1 and 2 hours, respectively...

How do I properly calculate total hours between two DateTime values in javascript MVVM?

Vladimir Iliev
Telerik team
 answered on 01 Oct 2014
1 answer
622 views
Hi,

I'm trying to create a cascading drop down list where the child (Order) is still enabled when the parent (Customer) has not been selected, as non selection means All Customers. i.e. the parent is the filter, so when its set to a particular value, the child shows the Orders that belong to that Customer, but when its not selected, the child should show all Orders.

I have tried setting AutoBind to true, but that doesn't seem to help.

Is this possible?

Thanks,

Chris

@(Html.Kendo().DropDownList()
    .Name("Order")
    .DataTextField("Text")
    .DataValueField("Value")
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("OrderList", "List")
                .Data("filterOrders");
        })
        .ServerFiltering(true);
    })
    .OptionLabel("Please Select")
    .AutoBind(true)
    .CascadeFrom("Customer")
    .Enable(true)

Script
function filterOrders() {
    return {
        customerID: $("#Customer").val()
    };
}

Georgi Krustev
Telerik team
 answered on 01 Oct 2014
5 answers
319 views
Hello,

I have line charts with multiple data (even more than 10.000 points). I see that Kendo UI supports pan and zoom option. Though I found only example code for Html http://demos.kendoui.com/dataviz/bar-charts/pan-and-zoom.html. Is there some kind of example code for MVC ?


Best regards.


Iliana Dyankova
Telerik team
 answered on 30 Sep 2014
2 answers
184 views
I have the Required attribute on my model, but when I use DatePickerFor, Kendo Validator does not pick that up.  If I use the F12 tools and manually add "required='required'" to the input that the DatePicker renders, then Validator picks it up and shows a message next to the picker.  Besides that, it's also not picking up the ErrorMessage on my Required attribute.  I'm assuming I could add another attribute to the <input> for it to pick that up as well, but not yet sure what the attribute name is.  Can you please explain why I can't just get this behavior out of the box, and if this is a bug with the DatePickerFor?  I'd rather not have to use .HtmlAttributes to manually stick these things onto every DatePicker.  Maybe I'm just missing something, but for something like this, you expect it to just work.  Thanks!
Michael
Top achievements
Rank 1
 answered on 29 Sep 2014
4 answers
5.3K+ views
Hi there,

in my case, I have a ViewModel on the client side. It works and shows the data from the "real" model. The real model consists of an object that contains other objects, e.g. ArchivedDoubleValue refers to a Station, which has a name, via its StationId. In my ViewModel, things are flattened in order to be fast and avoid circular dependencies, so there is:

int Id (ArchivedDoubleValue.Id)
double Value (ArchivedDoubleValue.Value)
string StationName (refers to Station.Name and gets set in the controller)

Now, when I want to sort or filter the StationName column, I run into an error, because StationName does not exist in the "real" model, only StationId.

So I thought I could simply "translate" the Member String in DataSourceRequest.Groups and DataSourceRequest.Sorts back into the corresponding Id. That worked quite well:

When grouping in the client, the request.Groups contains an entry with its Member set to "StationName". This is just a string and I change it to the corresponding StationId. Same works well for sorting.

But it DOES NOT work for filtering!  When debugging and peeking into he request at runtime, I can see and change the Filters Members and Values, but when I try to change it via code in the controller, I can not access it:

            if (request.Filters.Count > 0)
            {
                foreach (var f in request.Filters)
                {
                    String fs = f.Member.ToString();

This gives me an error:
Kendo.Mvc.IFilterDescriptor does not contain a definition for "Member"

How am I supposed to filter the "real" data with the filter set to a column in my ViewModel? I wonder how to do that? Or is there a way to access request.Filters? I think that would be the most elegant way to do it as it wiould be transparent to the client.

Please help me with that, thanks in advance!

Regards, Rob
Rosen
Telerik team
 answered on 29 Sep 2014
1 answer
121 views
My Kendo Comboxbox server binding is not working

This is my View
 @(Html.Kendo().ComboBox()
              .Name("cbxState")
              .HtmlAttributes(new { style = "width:150px" })
              .Text("Select State")
     
              .DataTextField("Code")
              .DataValueField("Code")
               .Filter(FilterType.Contains)
              .DataSource(source =>
              {
                  source.Read(read =>
                  {
                      read.Action("cbx_read", "Home");
                  })
                  .ServerFiltering(true);
              })
              )


This is my Controller       

public ActionResult cbx_read([DataSourceRequest]DataSourceRequest request)
         {
             using (var northwind = new Connection())
             {
                 IQueryable<LostDayDetail> Customers = northwind.LostDayDetail;
                 DataSourceResult result = Customers.ToDataSourceResult(request, Customer => new CustomerDetail
                 {
                     Code = Customer.Code,
                     Name = Customer.Name,
                     Days = Customer.Days
                 });
                 return Json(result);
             }
        }

When I click on Combobox, it calls cbx_read function and it gets all 12 rows of data from database table. but when contol comes back to view, the combobox is blank.
Please help me




Georgi Krustev
Telerik team
 answered on 29 Sep 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
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?