Telerik Forums
UI for ASP.NET MVC Forum
4 answers
321 views
I'm migrating a project based on the telerik MVC extensions, over to Kendo, and I'm having problems with an edit form.

It's based on a custom object, which uses data annotations for validation, on a couple of decimal fields:-
[Required(ErrorMessage = "Activity Value is required!")]
       [Range(0, 90000000, ErrorMessage = "Activity Value Cannot be less than zero!")]
       [RegularExpression(@"^\d{1,8}(\.\d{1,4})?$", ErrorMessage = "Please enter a numeric value with up to four decimal places.")]
       public decimal Activity { get; set; }

When a record is inserted, the regular expression validation error message is shown, even though the data entered meets the criteria. The only way to get the form to work is to comment out the regular expression rule. The range validation works fine.

This code worked perfectly using the old MVC extensions grid and pop-up edit form. How can I get this to work using the Kendo grid?
Vladimir Iliev
Telerik team
 answered on 26 Feb 2015
1 answer
306 views
I'm migrating an application from the old Telerik Mvc controls to the latest UI for ASP.NET MVC wrappers.

I have a bunch of unit tests that validated the controller actions that the grid calls for data.  A simple example would be:

<TestMethod()>
Public Sub GetLogEntryData_Passes_Through_Filters_On_Multiple_Columns()
  Dim passedCmd As GridParameters = Nothing
  _adminLogService.Setup(Function(s) s.GetLogEntries(It.IsAny(Of GridParameters))).Returns(_validLogEntries).Callback(Sub(p) passedCmd = p)
  Dim target As New AdminLogController(_adminLogService.Object, Nothing)
  Dim cmd As GridCommand = GridCommand.Parse(1, 10, Nothing, Nothing, "UserName~eq~'test'~and~ControllerName~startswith~'Users'")
  target.GetLogEntryData(cmd)
  Assert.IsNotNull(passedCmd)
  Assert.AreEqual(2, passedCmd.Filters.Count)
End Sub

Now that I have replaced the grids and I'm passing a DataSourceRequest instead, I don't suppose there's a similarly handy function that can replace the GridCommand.Parse statement?

Cheers,
Nick
Rosen
Telerik team
 answered on 26 Feb 2015
2 answers
625 views
Hi,

When i add or edit one grid and at the same time try to edit another grid, its  foreign key is not showing its template. I need to know how to get a id unique for my editor template. Now I show you the secene


I have two views, in the first view I call to the second view

@(Html.Kendo().TabStrip()
   .Name("service_details_tabstrip_#=ServiceID#")
   .Items(items => { items.Add().Text("Detall Residus")
   .Selected(true)
  .LoadContentFrom("Waste", "Serveis", new { id = "#=ServiceID#" });
})
 .ToClientTemplate()


In the second view I have next sentence:

string serviceID = ViewBag.ServiceID.ToString();



The grid on the second view:

@(Html.Kendo().Grid<ServiceDetailViewModel>()
  .Name("waste_details_" + serviceID)
  .ToolBar(t =>{
   if (User.IsInRole("Modify")){
       t.Create().Text("Afegir Residu");
       t.Custom().Text("Afegir Residus Contracte").HtmlAttributes(new { id = "wasteContract_" + serviceID });
  }
})
 .Columns(columns =>
{
 columns.Bound(f => f.DetailID);
 columns.ForeignKey(f => f.Reference, (System.Collections.IEnumerable)ViewBag.CatalegResidus, "Value","Text").EditorTemplateName("GetWasteByServeis").Width(400);

The template "GetWasteByServeis" needs something to be unique:

@(Html.Kendo().DropDownList()
   .Name("Reference_@serviceID") <=== this it's not ok
   .DataTextField("Text")
   .DataValueField("Value")
   .Filter(FilterType.Contains)
   .OptionLabel("-please select-")
   .ValuePrimitive(true)
   .AutoBind(false)
   .DataSource(source =>
{
 source.Read(read =>
    {
         read.Action("SearchWaste", "Serveis").Data("filterSearchWaste");
    }) .ServerFiltering(true);})
)


In this thread I find information relationed.
http://www.telerik.com/forums/grid-foreign-key-field-sometime-shows-textbox



Thanks in advance.


Xavier.
Xavier
Top achievements
Rank 1
 answered on 26 Feb 2015
5 answers
218 views
Hi,

How can i add combobox to some cell in the Edit mode? Is there example for this?
Alexander Popov
Telerik team
 answered on 26 Feb 2015
1 answer
125 views
Hi,I'm trying to define individual business hours for the scheduler. The scheduler only uses a single start/end time for each work day. I want to define start/end times for each day specifically (ie. Monday has different times than Tuesday). 
Eg: 
Sunday working hours @ 10:00 to 12:00 
Monday working hours @ 9:00 to 16:00 
Tuesday working hours @ 10:00 to 18:00 
Wednesday working hours@ 06:00 to 12:00 
Thursday working hours @ 08:00 to 14:00 
Friday working hours @ 11:00 to 12:00 
Saturday working hours @ 11:30 to 13:00Can anyone resolve my problem.Thanks in advance
Vladimir Iliev
Telerik team
 answered on 26 Feb 2015
1 answer
148 views
I have a model with ID and and array of values, I need each of the array value to be displayed in separate column in kendo grid and all this should be editable fields.

public int Id { get; set; }
public double[] List { get; set; }

I have tried the following way however it display all values in one cell.


@model IEnumerable<HoursModel>

<div id="PlanningGrid">
    @(Html.Kendo().Grid(Model)
          .Name("Grid")
          .Columns(columns =>
          {
             //// columns.AutoGenerate(true);
              
              columns.Bound(c => c.Id).HeaderHtmlAttributes(new {@class = "grid-header-cell"}).HtmlAttributes(new {@class = "grid-row-cell planningoverview-grid-cell1"});

              columns.Bound(p => p.List).ClientTemplate("#=generateTemplate(HoursList)#");
              //// columns.Bound(m => m.EmployeeId).ClientTemplate("# for (var i=0;i<4;increment(i)) { console.log(i) } #");
              
          })
          .Sortable())
    
</div>

<script type="text/javascript">
    function generateTemplate(Wetness) {
        var template = "<ul>";
        for (var i = 0; i < Wetness.length; i++) {
            template = template + "<li>" + Wetness[i] + "</li>";
        }
        return template + "</ul>";
    }
 
</script>
Rosen
Telerik team
 answered on 25 Feb 2015
2 answers
1.6K+ views
I want to have the dropdown default select a value.  I have the value is in a ViewData.  How can I access this from javascript?

@(Html.Kendo().DropDownList()
                       .Name("locationCode")
                       .HtmlAttributes(new { style = "width:200px" })
                       .DataValueField("Code")
                       .DataTextField("Name")
                       .DataSource(source =>
                                    {
                                        source.Read(read =>
                                        {
                                            read.Action("GetUserGlobalDimensions", "RequestPONumber");
                                        });
                                    }

                                  )
                        .Events(e => { e.DataBound("onLocationDataBound"); })

In js file:
function onLocationDataBound() {
    this.value('ViewData["defaultLocationValue"]');
}

Thanks in advance.



Greg
Top achievements
Rank 1
 answered on 24 Feb 2015
1 answer
122 views
Hi,

I am trying to export a form created with kendo panel. See the first attach file.
So, it's work very well but each input field are empty. Maybe because i user razor components like this:

@Html.TextBoxFor(m => m.CNom, new { @placeholder = "Nom", @class = "form-control form-decouverte form-nom ChampsObligatoire" })

I attach the pdf file for showing you the results.

So i you have an idea about this prolem.

Thanks,

Ludovic



Mihai
Telerik team
 answered on 24 Feb 2015
1 answer
629 views
Hi,

I'm trying to implement the Kendo Editor in an application i'm working on. I'm trying to use the editor to allow the user to insert an image with text around it. I have attempted 2 different methods and neither are acceptable.

I can't find any tool/option for wrapping the text around the image. E.g. i want an image on the right and text on the left.

I can insert a table and put the image in the right column and text in the left column but i am unable to drag the table column to size around the image. At the moment it just appears to remain at 50%.

Any help is much appreciated.

Thanks

Anthony

Dimo
Telerik team
 answered on 24 Feb 2015
4 answers
2.0K+ views
I have a number of Kendo Editor's used in my application.  Much of the text entered via the Editor will be displayed in a Kendo Grid.  I am using the Black theme, so the background color in the grid is a gray, which is fine.  The background color of the Kendo Editor text area is white.  I want to change that from white to a gray, or the same color as the grid background.  This way you will be able to enter the text as it will appear in the grid
Alex Gyoshev
Telerik team
 answered on 24 Feb 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?