I have a page, bound to a model, with several dropdownlistfor controls. These work ok, however, some items on the form only need to be shown depending on the values of other fields. I can do this using the change event on the dropdownlist without a problem.
However, I also need this logic to fire, once the page is initially loaded, (as the page is an edit form as well as a new record form). Using the $(document).ready() function, when I try to read the value from the dropdownlist, I get an undefined or null reference error, as it seems the dropdownlist hasn't yet been bound to the data.
I also get this error using the $(window).load() function. How can I get the initial value of the dropdown list, once the page has loaded, so I can process the logic needed to show / hide the appropriate sections of the form?
The code I have is:-
var dropdownlist = $("#Replacement").data("kendoDropDownList");var dataItem = dropdownlist.dataItem();var replacementVal = dataItem.Code;if(replacementVal=='Y'){    $('#divReplacementPost').show();}else{    $('#divReplacementPost').hide();}Thanks
Hi,
Which Telerik UI Asp.net MVC control we should use to accomplish attached functionality?
Thanks
Hi,
I want to load the grid from an offline source like in this example, http://stackoverflow.com/questions/12980444/caching-a-kendo-ui-datasource-object-using-localstorage. However that example is using KendoUI directly, whereas I am creating the grid using the MVC HtmlHelper. In the helper there is no overload on the Read method on the DataSource to specify a javascript function. How do I do the equivalent with the HtmlHelper, or do I need to mix and match?
Hello,
I've been reading up on the documentation about the customisation of exported excel documents from the grid. My project is an MVC applicaation using razor views. My question is how do you marry the grid to the javascript so that when the user presses "export" it runs the function?
For example my grid looks like this:
  @(Html.Kendo().Grid<Widget_Tests.Models.tbl_data>()
        .Name("Grid")
        .Columns(columns =>
            {
                columns.Bound(c => c.old_id).Title("Old ID");
                columns.Bound(c => c.name).Title("Name");
                columns.Bound(c => c.type).Title("Vessel Type");
                columns.Bound(c => c.company).Title("Company");        
            }
        )                
        .ToolBar(toolbar =>
            {
                toolbar.Excel();                               
            }
        )
        .Pageable()
        .Scrollable()
        .Excel(excel => excel
            .FileName("MyGrid.xlsx")            
            .AllPages(true)
            .Filterable(true)            
            )
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(50)
            .Read(read => read.Action("tbl_data_Read", "Home"))            
            )            
        )
Here is the javascript I found in the documentation:
  function saveExcel() {
        var workbook = new kendo.ooxml.Workbook({
            sheets: [
              {
                  columns: [{ autoWidth: true }],
                  rows: [
                    {
                        cells: [
                          {
                              value: "bold and italic",
                              bold: true,
                              italic: true
                          }
                        ]
                    },
                    {
                        cells: [
                          {
                              value: "red text on blue background",
                              color: "#ff0000",
                              background: "#0000ff"
                          }
                        ]
                    },
                    {
                        cells: [
                          {
                              value: "Arial 20px",
                              fontSize: 20,
                              fontName: "Arial"
                          }
                        ]
                    },
                    {
                        cells: [
                          {
                              value: "Right aligned",
                              hAlign: "right"
                          }
                        ]
                    },
                    {
                        cells: [
                          {
                              value: "Centered horizontally and vertically",
                              vAlign: "center",
                              hAlign: "center",
                              rowSpan: 2
                          }
                        ]
                    }
                  ]
              }
            ]
        });
    };
kendo.saveAs({
    dataURI: workbook.toDataURL(),
    fileName: "Test.xlsx"
});
How do these go together?
Is it possible to make a custom view for the Kendo ui MVC Gantt chart?
I've found documentation on how to do this in JavaScript.
Is this possible? If so is there any documentation or demo instructing on how to do this?
Thanks in advance!
var _curId = 1;function onGridSave(e) {    var newId = _curId++;    e.model.set('id', newId);    e.model.set('EncryptedIngredientId', newId);}@(Html.Kendo().Grid<IngredientViewModel>(Model.ServerData)    .Name("IngredientsGrid")    .Editable(editable => editable.Mode(GridEditMode.InLine).Enabled(true))    .BindTo(Model.DataAfterEdit ?? Model.ServerData)    .DataSource(ds => ds        .Ajax()        .ServerOperation(false)        .Events(ev => ev.Change("onGridChange").Error("onGridError"))        .Model(m => {                 m.Id(p => p.EncryptedIngredientId);                 m.Field(p => p.EncryptedIngredientId).DefaultValue(Guid.NewGuid().ToString());                 m.Field(p => p.PercentInfo).DefaultValue(new PercentInfoViewModel());             })        .Read("IngGrid_Read", "Company") // <-- dummy action that doesn't exist in controller        .Update("IngGrid_Update", "Company") // <-- dummy action that doesn't exist in controller        .Create("IngGrid_Create", "Company") // <-- dummy action that doesn't exist in controller        .Destroy("IngGrid_Destroy", "Company")) // <-- dummy action that doesn't exist in controller    .ToolBar(tbar => tbar.Create())    .Columns(c => {               c.AutoGenerate(false);               c.Bound(m => m.CasNumber);               c.Bound(m => m.IngredientName);               c.Bound(m => m.PercentInfo).ClientTemplate("#= makePercentageDisplayString(data.PercentInfo) #").Width(180);               c.Bound(m => m.ReachRegNumber);               c.Bound(m => m.ReachSvhc);               c.Bound(m => m.RohsSubstance);               c.Bound(m => m.Prop65Substance);               c.Command(command => {                             command.Edit();                             command.Destroy();                         }).Width(200);           })    .Events(evt => {                evt.Save("onGridSave");                evt.Edit("onGridEdit");            }))Hello,
I have Kendo grid which has Export to PDF button and other Buttons on toolbar. So i am using a toolbar template. As mentioned in Posts to hide toolbar i used the following css to hide toolbar button in exported pdf.
 .k-pdf-export .k-grid-toolbar,
      .k-pdf-export .k-grouping-header {
        display: none;
      }
But my pdf file Shows the toolbar with all Buttons. So i believe must be something to do with template. Please suggest how can i hide toolbar template in export
Thanks
Anamika
