Telerik Forums
UI for ASP.NET MVC Forum
1 answer
92 views
I have kendo grid have some columns and one of these columns is foreign key and implemented as combobox inside editor template and the datasource is a collection of values retrieved from database. when the grid loaded and when edit or insert the first row the read function will run and will get the values from DB but in the second edit or insert the read function will not run and the combobox will retrieve his datasource from the first edit. My question is how to make the combobox run the read function in every edit or insert?
This is my code:
columns.Bound(p => p.Employee).ClientTemplate("#=Employee.EmployeeText#").Width(110);//This column for foreign key

and my view model:
[UIHint("EmployeeForeignKeyEditor")]
public EmployeeViewModel Employee { get; set; }

and the EmployeeForeignKeyEditor is in EditorTemplates folder inside Shared:
@model SpinePOCViewModel.ViewModels.EmployeeViewModel
@(
Html.Kendo().ComboBox()
.DataTextField("EmployeeText")
.DataValueField("EmployeeID").Name("Employee")
.Placeholder("Select Employee")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("MarketingCoordinatorcb_Read", "Marketing");
})
.ServerFiltering(true);
})
.AutoBind(false)
)

and read function:
public ActionResult MarketingCoordinatorcb_Read()
{
ViewBag.Employees=SomeFunctionToGetData();
return Json((List<EmployeeViewModel>)ViewBag.Employees, JsonRequestBehavior.AllowGet);
}

and Employee view model:
public partial class EmployeeViewModel
{
public int EmployeeID { get; set; }
public virtual string EmployeeText { get;set;}
}
Vladimir Iliev
Telerik team
 answered on 30 Aug 2013
5 answers
225 views
Using the editable template I want to have a drop down for my resources, so far I have
<div class="k-edit-field" data-container-for="TeamId">
    <input data-role="combobox" data-bind="value: TeamId" />
</div>
This gives me the value, but not the list, how do I get the list ?
 thanks


Alan Mosley
Top achievements
Rank 1
 answered on 30 Aug 2013
1 answer
63 views
Recreated this http://demos.kendoui.com/web/treeview/remote-data.html using latest nightly

On expanding, the root folder seems to contain itself, the returned id never seems to be bound to the tree view at all.
Daniel
Telerik team
 answered on 29 Aug 2013
1 answer
126 views
Hello,
please excuse me if I post you this but I was wondering what's the best approach for implementing this...
I've got a Grid witch has 3 column that will be editable and will have to show a dropdown while editing... we can call them Country,Profile and Status
I've to prefix that I came from SL world so what I do in that world would be
  • call the services GetCountries,GetProfiles and GetStatus
  • save those datas in 3 different collection
  • at the cell edit open the dropdown loading the corresponding collection as possible values and selecting the selected matching the IdCountry,IdProfile.IdStatus

How can I do this in the MVC world? I think I can't have all done via Mvc without using javascript... or should I create a viewmodel that holds those collections?

If I use "pure" js I would have 3 calls to the service from js, store the values and perform as I've written above

Any suggestion?
Thanks

Petur Subev
Telerik team
 answered on 29 Aug 2013
4 answers
215 views
Hello folks,
     If I set up an editor and set .Encode() to false OR specify .ViewHtml(), as soon as I click in the editor or show the Html by pressing the View Html button, the change event is fired which isn't really true from a user perspective.
Is there a way to prevent that behavior OR is there a way to know it's the encoding (or any other internal mechanism of the component) that fires the change so I can handle it properly?
What I want to achieve is, when the editor changes, I want to set a page dirty flag so I can notify the user something changed and wasn't saved in the editor.

Regards,

Stephan
Stéphan Parrot
Top achievements
Rank 1
 answered on 29 Aug 2013
1 answer
501 views
Hi to all,
I am doing crud operation by using Kendo Grid and using default window opening.

I searched a lot for custom window but didn't find the good example.

what i wants is that on Add and Edit  i wants to open my own form in Kendo window
i.e create.cshtml and Edit.cshtml .

I used lot of examples of kendo window but there were lot of problem sometimes
 window not opening sometime form design changing when clicking again and again.

Please guide me what to do
or if possible provide me sample where cutom window can be open on Add and edit
and i can load my forms inside that.

Thanks
Jack
Top achievements
Rank 1
 answered on 29 Aug 2013
6 answers
1.4K+ views
Hi to all, i am facing one problem while binding my json data to Kendo grid

I have 7 columns in  database . I ma fetching 5 columns and sending data through json and binding Kendo Grid,
but when passing those 6th or 7th column Kendo grid not showing anything as its coming in json result.

Please help as i don't know what to do with this

@(Html.Kendo().Grid(Model)  
    .Name("Grid")
     .Columns(columns =>
      {        
          
          columns.Bound(model => model.FirstName).Width(150);
          columns.Bound(model => model.LastName).Width(150);         
          columns.Bound(model => model.EmailAddress).Width(150).Sortable(false);        
          columns.Bound(model => model.IsActive).Width(100);
          columns.Bound(model => model.LoginName).Width(100).Visible(false);
          //columns.Bound(model => model.Address).Width(100).Visible(false);
          // Add "Edit" and "Destroy" commands
          columns.Command(command => { command.Edit(); }).Width(100);
         
      })
   .Pageable(pageable => pageable.ButtonCount(5))
  
    .Sortable(sort => sort.Enabled(true))
    .Filterable()
    .Scrollable()
    .Groupable()
    // Add "Create" command
    .ToolBar(commands => commands.Create())
     // Set the edit mode to "PopPup"
    .Editable(editable => editable.Mode(GridEditMode.PopUp))
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        
          
            .Ajax()
            .PageSize(50)
            .ServerOperation(false)
            .Model(model => model.Id(p => p.ID))
            
            .Create("InsertUser","ProductKendo")
            .Update("UpdateUser","ProductKendo")
             .Destroy("DeleteUser","ProductKendo")
            
        
        .Read(read => read.Action("GetUserDataKendo", "ProductKendo")
           
        
        )
    ) .Resizable(resize => resize.Columns(true))
    
    
)

when i send address field,grid doesn't show anything

Thanks
Jack
Top achievements
Rank 1
 answered on 29 Aug 2013
1 answer
2.1K+ views
Hello,
I've got some troubles validating 4 dropdownlist I've on a page... I've looked at this page

http://demos.kendoui.com/web/validator/index.html

but it refers to HTML version and I don't know how to use it with Kendo Wrappers...

Here's a piece of code only for the first dropdownlist (the other 3 are similar)

<div id="myform">
        @(Html.Kendo().DropDownList()
          .Name("cbFiliali")
          .HtmlAttributes(new { style = "width: 250px" })
          .DataTextField("Descr")
          .DataValueField("ID")
          .DataSource(source =>
          {
              source.Read(read =>
              {
                  read.Action("GetListaFiliali", "Common", new { Area = string.Empty });
              }).ServerFiltering(false);
          })
                     
        )
 
        <input id="btnCarica" type="button" value="CARICA" />
    </div>
 
 
    <script>
        var validator = $("#myform").kendoValidator(
            {
                rules: {
                    customRule1: function (input) {
                        // all of the input must have a value
                        return $.trim(input.val()) !== "";
                    }
                }
            }).data("kendoValidator");
 
        //validate the state on button click
        $("#btnCarica").click(function () {
            //validate the input elements and check if there are any errors
            //if (validator.validate()) {
            if (validator.validateInput($("DropDownList[name=cbFiliali]"))) {
                var ddFiliali = $("#cbFiliali").data("kendoDropDownList");
                var filiale = ddFiliali.value();
                alert(filiale);
            }
            else
                alert("NON VALIDO");
        });
 
</script>
Is there a way of forcing a value to be selected? I'm not really familiar with javascript so maybe I'm missing something really simple...
Thanks
Daniel
Telerik team
 answered on 29 Aug 2013
4 answers
125 views
Hello!

I've downloaded the Telerik Pack and installed, but today was the first day I actually could start using the Kendo UI.I created a new MVC 4 application (actually, I'm also learning the MVC). Then then I went to the Kendo UI documentation.I saw that there is a VS Extension here http://visualstudiogallery.msdn.microsoft.com/65b78c2c-951e-43a8-bae7-f9039f59fb9b
I tried to install it, but the .vsix just opened, the mouse cursor change to "waiting" for a bit, than it just stops. No error message, no window opening, nothing. Is there another way to install the VS Extension without the .vsix from the link?
Thanks in advance!
Momchil
Telerik team
 answered on 28 Aug 2013
1 answer
123 views
Using the internal build, the tooltip appears once and then all subsequent triggers fail to make the tooltip reappear, even though the DOM element is still on the page.

This is a regression bug I remember it from a few releases ago.
Dimo
Telerik team
 answered on 28 Aug 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?