Telerik Forums
UI for ASP.NET MVC Forum
4 answers
2.8K+ views

Hi,

I am facing problem while using kendo dropdownlist with kendo grid. I have a kendo grid with all the fields as dropdown (around 12 fields) except one column(employeename) as a simple display column. For dropdown fields, I have created partial views as EditorTemplates and attached them to the grid column. But when I run my application, initially it does not display the dropdowns. When click the cell turns into a dropdown field and when I select any value and change focus, the grid cell gets populated with dropdown value property and not the text property. For some of the columns, it even does not set the selected value in cell. No idea what is the issue. below is my code:

@(Html.Kendo().Grid(Model)
            .Name("EmployeeHarborGrid")
            .EnableCustomBinding(false)
            .Columns(columns =>
              {
                    columns.Bound(d => d.EmployeeName).Title("Employee");
                    columns.Bound(d => d.AcaJobClassification).Title("ACA Job Classification")
                               .EditorTemplateName("_AcaJobClassification").Width(120).ClientTemplate("#:AcaJobClassification#");
                    columns.Bound(d => d.TwelveMonthsOffer).Title("12 Months Offer")

              }

 

my editor template code:

@using Kendo.Mvc.UI
@(Html.Kendo().DropDownListFor(m => m)
.Name("AcaJobClassification").HtmlAttributes(new { @style = "font-size:12px" })
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>()
{
new SelectListItem() {Text="--Please Select--", Value="0"},
new SelectListItem() {Text="Contract", Value="1"},
new SelectListItem() {Text="Educator", Value="2"},
new SelectListItem() {Text="Fulltime", Value="3"},
new SelectListItem() {Text="Parttime", Value="4"},
})
.SelectedIndex(3)
)

 

If employee record exists, then I want the dropdowns to pick the record value and set the dropdown index accordingly.

Can I achieve this with ClientTemplate attribute on the column. I would prefer using ClientTemplate instead of creating EditorTemplate. Please suggest. Also, I want to bind this dropdown with an Enum list but facing problem with that as well. Can you help me out with that as well?

Appreciate your quick reply. 

Thanks.

 

Alexander Popov
Telerik team
 answered on 16 Sep 2015
1 answer
112 views

Hello All,

               I have attached the screenshot for better understanding.

I have a control in classic asp technology which behaves like tree in left panel and in the right panel it behaves like a Excelsheet

where a user can work as he is working as a excel person.

I want to know the similiar control which is useful for me to make the same functionality as this attached file is showing it.

please kindly let me know .

Shaikh
Top achievements
Rank 1
 answered on 16 Sep 2015
2 answers
121 views

Hi,  

I'm trying to customize the filter of a column of date type. By default the filter UI of date type is is an operator type of equal/before/after with a datepicker. But I want the filter to be more powerful. I want to filter by specific date or by number. If it is by date then it is no difference with the default filter. But if it is filtered by numbers (days and hours), I hope it can be filtered by the difference of days and hours between now and the date value in database. 

The server side is implemented with ASP.NET WEB API with odata. It seems obvious that the filter parameter passed to the server side should be converted to a date on the client when filtering by day and hour number. To distinguish the filter type between date and day/hour number, I think a switcher is also needed on the UI. 

I'd like to know, if this kind of filter customization (a standard UI with an extra filter type switcher, days and hours textbox ) is possible? Is there an api giving me the chance to convert the numbers to a date before submitting for server side filtering?

Thank you for your help!

Paddy
Top achievements
Rank 1
 answered on 16 Sep 2015
4 answers
1.8K+ views

Hello all, 

 I'm evaluationg the controls for my application and I'm currently stuck in something really stupid.  I'm using the Kendo Textbox helper and added the required attribute like this:

 

@(Html.Kendo().TextBox()
         .Name("LastName01")
         .HtmlAttributes(new { placeholder = "Apellido Paterno", required = "required", validationmessage = "Enter {0}", @class = "col-sm-2 form-control" })
            )
<span data-for='LastName01' class='k-invalid-msg'></span>

 

But the position of the valition message is off, how can I get it under the textbox?  Attached is the screen shot.

Plamen Lazarov
Telerik team
 answered on 15 Sep 2015
3 answers
816 views

 Hi,

 I'm trying to set the autofocus on my edit screens. If it's an Kendo-control that I want to have autofocus, it doesn't seem to work.

 I tried setting the HtmlAttributes for de dropdownlist:

<div class="form-group">
    @Html.LabelFor(model => model.IdLocation, htmlAttributes: new { @class = "control-label col-sm-2" })
    <div class="col-md-10">
        @(Html.Kendo().DropDownListFor(model => model.IdLocation)
              .DataTextField("Value")
              .DataValueField("Key")
              .OptionLabel("Selecteer... ")
              .HtmlAttributes(new { autofocus = "" })
              .DataSource(source => source.Read(read => read.Action("GetAllItemsAsDictionary", "Location")))
        )
    </div>
</div>​

As a result I see an input element generated with the attribute autofocus set, but also with style 'display: none'.

<div class="col-md-10">
  <span aria-activedescendant="d012aecf-c5cf-41cd-b307-85b7dfad7807" aria-busy="false" aria-readonly="false" aria-disabled="false" aria-owns="IdLocation_listbox" tabindex="0" aria-expanded="false" aria-haspopup="true" role="listbox" unselectable="on" class="k-widget k-dropdown k-header" title="" style="">

    <span unselectable="on" class="k-dropdown-wrap k-state-default">

      <span unselectable="on" class="k-input">12a (Riek)</span>

      <span unselectable="on" class="k-select">

        <span unselectable="on" class="k-icon k-i-arrow-s">select</span>

      </span>

    </span>

    <input style="display: none;" data-role="dropdownlist" autofocus="" data-val="true" data-val-number="The field Locatie must be a number." data-val-required="The Locatie field is required." id="IdLocation" name="IdLocation" value="1" type="text">

  </span>

  <script>
    jQuery(function(){jQuery("#IdLocation").kendoDropDownList({"dataSource":{"transport":{"read":{"url":"/events/Location/GetAllItemsAsDictionary"},"prefix":""},"schema":{"errors":"Errors"}},"dataTextField":"Value","dataValueField":"Key","optionLabel":"Selecteer... "});});
  </script>
</div>​

So my question is how to make a Kendo dropdownlist having autofocus?

Thank you for a reply.

Georgi Krustev
Telerik team
 answered on 15 Sep 2015
7 answers
312 views

Hi All,

 

I'm currently in a trial period for the MVC UI suite, and i'm currently configuring the pivot grid to fit our current project.

 

Now just currently going through the features of this pivot grid i realise that the AJAX pivot grid has far more functionality than the MVC one.

 

One function in particular i would like for the MVC pivot grid is the AJAX pivot grid field list functionality, as seen here.

 

Now is this possible? And if so is there any examples of this.

 

Thanks,

 

Jamie

 

Georgi Krustev
Telerik team
 answered on 15 Sep 2015
23 answers
548 views
At my organization, we have attempted to upgrade an asp.net MVC solution in Visual Studio 2013 using the Solution Upgrade Wizard from v2014.1.318.545 to v2014.1.528.545 on two different machines without success. 

The wizard manages to remove old content and scripts and add 400+ files, but a crash always occurs before it completes the process.  The crash causes the environment to restart, and the upgrade is very obviously incomplete.

Is this an issue that has been reported by anyone else?  Is there an alternative way to update our project instead of using the upgrade wizard?  Thanks!
Ventsi
Telerik team
 answered on 15 Sep 2015
1 answer
94 views

I've got data that looks like this from a DB:

FromSomething    ToSomething    Amount

place a                   place b             1.55

place d                   place b              2.33

place a                   place f               1.20

and so on .....

I need it to go in a matrix that looks like this:

                  place b           place f       place m

place a       1.33               1.25          .50

place b        0                   1.00          .25

 

I can't get this to work at all, using the pivot grid and configuring it like the Telerik demos site, using local binding.  The grid is blank.

Is the pivot grid right for this?  If so, how should it work?

Georgi Krustev
Telerik team
 answered on 15 Sep 2015
1 answer
180 views

What is the recurrenceId field for in the scheduler and if it is important why or why is it not part of the ISchedulerEvent interface that is required for the scheduler view model???????????????????

What exactly is going on with this product?

Vladimir Iliev
Telerik team
 answered on 15 Sep 2015
1 answer
1.2K+ views

Hi,

I am having problems getting the total count field from JSON odata using the Html Helper for the Kendo Grid. Getting the odata.count value using JavaScript is fine though but our preference is to use the MVC html helper. The following is both examples:

 

Using MVC Html Helper produces the following JavaScript error: Uncaught TypeError: Cannot read property 'count' of undefined. See the Schema property for where we are trying to get the oData.count.

@(Html.Kendo().Grid<DataObject>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(e => e.Field1).Filterable(false);
        columns.Bound(e => e.Field2);
        columns.Bound(e => e.Field3);
    })
    .DataSource(dataSource => dataSource
        .Custom()
        .Type("odata")
        .Schema(schema =>
        {
            schema.Data("value")
                 .Total("odata.count");
        })
        .Transport(transport =>
        {
            transport.Read(read => read.Url("/odata/DataUrl).DataType("json"));
        }
        )
        .PageSize(5)
        .ServerPaging(true)
        .ServerSorting(true)
        .ServerFiltering(true)
    )
    .Pageable()
    .Sortable()
    .Filterable()
)


Using the following JavaScript works:

$(".grid").kendoGrid({
            dataSource: {
                type: "odata",
                transport: {
                    read: {
                        url: "/odata/DataUrl",
                        dataType: "json"
                    }
                },
                schema: {
                    data: function(data) {
return data['value'];
                    },
                    total: function(data) {
                        return data['odata.count'];
                    },
                    model: {
                        fields: {
                            Field1: { type: "date" },
                            Field2: { type: "string" },
                            Field3: { type: "string" },
                        }
                    }
                },
                pageSize: 20,
                serverPaging: true,
                serverFiltering: true,
                serverSorting: true
            },
            filterable: true,
            sortable: true,
            pageable: true,
            columns: [
                {
                    field: "Field1",
                    filterable: false,
                    format: "{0:MMM dd, yyyy}"
                },
                {
                    field: "Field2",
                    filterable: false
                },
                {
                    field: "Field3",
                    filterable: false
                }
            ]
        });



JSON

{
  "odata.metadata":"http://localhost:15649/odata/$metadata#​DataUrl","odata.count":"100","value":[
    {
      "​Field1":"2015-07-21T11:45:38.927"
      ,"​Field2":"2015-07-21T11:33:41.067"
      ,"​Field3":"2015-07-21T11:45:35.993"
    }
    ...
  ]}

 

Looking in the documentation there are only examples of this using javascript, are there some examples using the html helpers as well somewhere? Any pointers in the right direction are welcome.

thanks,

Rob

Alexander Popov
Telerik team
 answered on 15 Sep 2015
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?