Telerik Forums
UI for ASP.NET MVC Forum
0 answers
277 views
I've seen some of the documentation regarding how to create custom icons for Kendo UI Mobile, but can someone please give me an example of how it is applied to the MobileTapStrip in ASP.NET MVC?

Here's what I've tried so far:

<style>
    .km-root .km-pane .km-view .km-home1
    {
        background-image: url("/Images/Icons/home1.png");
    }
</style>

@(Html.Kendo().MobileLayout()
    .Name("mobile-main")
    .Footer(
        @<text>
            @(Html.Kendo().MobileTabStrip()
                .Items(items => {
                    items.Add().Icon("home1").Text("Home").Url("#view-home");
                    items.Add().Icon("cart").Text("Purchases").Url("#view-purchases");
                    items.Add().Icon("bookmarks").Text("Reports").Url("#view-reports");
                })

            )
        </text>
    )
)

OK, I've figured it out:

@(Html.Kendo().MobileLayout()
    .Name("mobile-main")
    .Footer(
        @<text>
            @(Html.Kendo().MobileTabStrip()
                .Items(items => {
                    items.Add().Icon("home1").Text("Home").Url("#view-home");
                    items.Add().Icon("purchases").Text("Purchases").Url("#view-purchases");
                    items.Add().Icon("reports").Text("Reports").Url("#view-reports");
                })

            )
        </text>
    )
)

CSS:

.km-root .km-pane .km-view .km-icon {
    background-size: 100% 100%;
    -webkit-background-clip: border-box;
    background-color: currentcolor;
}

.km-home1 {
    -webkit-mask-box-image: url("/Images/Icons/home1.png");
    background-color: red;
}

.km-purchases {
    -webkit-mask-box-image: url("/Images/Icons/money.png");
    background-color: red;
}

.km-reports {
    -webkit-mask-box-image: url("/Images/Icons/documents.png");
    background-color: red;
}
Steven
Top achievements
Rank 1
 asked on 04 Aug 2013
9 answers
414 views
We've got a grid that needs to have the background-color / read only set based on their value.  I've seen some posts that discuss using the data bound event to set the color of the cell, and others that talk about client templates or editor templates, but I'm not finding one place to set both the cells background color and whether the value can be edited.  Since I'm constructing a VM object that encapsulates the column configuration (dynamically built columns / order / etc.) I'd like to keep as much of it together as I can.
Dimiter Madjarov
Telerik team
 answered on 02 Aug 2013
8 answers
1.1K+ views
I can't find any detailed documentation on client-side events so I will just post my issues as they come up. I have several issues with the grid events.
  1. In the Telerik grid, there was an OnComplete event. What is the Kendo grid equivalent?
  2. In the Edit client event:
    1. How do you determine the mode (add or edit)? In the telerik grid it was simply e.mode.
    2. How do you determine if the cancel click event on the edit form came from the edit or insert mode? In the Telerik grid I could do this:    
    $(e.form).find(".t-grid-cancel").click(function () {
 
    if (e.mode == "insert") {
       //do insert cancel cleanup code
    }
 
});

 
                3. What is the Kendo equivalent of this:                    

$(e.form).find(".t-grid").data("tGrid").ajaxRequest({ InventoryItemId: key });

 

    3. In the Save client event, what would be the equivalent of this code for Kendo?

e.values.inventoryItemId = key;

I think that is enough to start with..

Thanks in advance for any help!

suman
Top achievements
Rank 1
 answered on 02 Aug 2013
1 answer
295 views
I have an editor on a razor page:

@(Html.Kendo().EditorFor(model => model.Message.MessageText)
            .Name("Message.MessageText")
            .HtmlAttributes(new { style = "height:550px" })
            .Tools(tools => tools
                .Clear()
                .Bold()
                .Italic()
                .Underline()
                .Strikethrough()
                .FontColor()
                .BackColor()
                .InsertOrderedList()
                .InsertUnorderedList()
                .Indent()
                .Outdent()
                .CreateLink()
                .Unlink()
                )
            )
I have updated to the latest version of Kendo. In the release notes, it states as a new feature, "Ability to show the editor toolbar on focus". How can I do this?

Thanks,
Nick
Dimo
Telerik team
 answered on 02 Aug 2013
1 answer
716 views
I'm having a problem adding a child record in my hierarchical grid.  It won't pass over the HeaderId from the parent in the grid.

Here's the controller action:

@(Html.Kendo().Grid<BillHeader>()
 
    .Name("BillHeaders")
    .Columns(columns =>
    {
        columns.Bound(h => h.BillHeaderId);
        columns.Bound(h => h.Category);
        columns.Bound(h => h.Description);
        columns.Bound(h => h.Amount);
    })
    .Pageable()
    .Selectable(selectable => selectable
            .Mode(GridSelectionMode.Multiple)
            .Type(GridSelectionType.Row))
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(6)
        .Events(events => events.Error("error_handler"))
        .Read(read => read.Action("BillHeaders_Read", "Bill"))
    )
    .Events(events => events.DataBound("dataBound"))
    .ClientDetailTemplateId("BillDetails")
 
      )
 
<script id="BillDetails" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<BillDetail>()
          .Name("BillDetails_#=BillHeaderId#")
          .Columns(columns =>
          {
              columns.Bound(d => d.BillHeaderId).Width(50);
              columns.Bound(d => d.BillDetailId).Width(70);
              columns.Bound(d => d.Category).Width(70);
              columns.Bound(d => d.Description).Width(150);
              columns.Bound(d => d.Amount).Width(80);
              columns.Command(command =>
              {
                  command.Edit();
                  command.Destroy();
              }).Width(75);
          })
          .DataSource(dataSource => dataSource
              .Ajax()
              .PageSize(10)
              .Model(model =>
              {
                  model.Id(d => d.BillDetailId);
                  model.Field(d => d.BillDetailId).Editable(false);
              })
            .Events(events => events.Error("error_handler"))
            .Read(read => read.Action("BillDetails_Read", "Bill", new { billHeaderId = "#=BillHeaderId#" }))
            .Update(update => update.Action("BillDetail_Update", "Bill"))
            .Create(create => create.Action("BillDetail_Create", "Bill", new { billHeaderId = "#=BillHeaderId#" }))
            .Destroy(destroy => destroy.Action("BillDetail_Destroy", "Bill")))
           
          .Pageable()
          .ToolBar(tools => tools.Create())
          .ToClientTemplate()
          )
</script>

And here's the view.

[AcceptVerbs(HttpVerbs.Post)]
       public ActionResult BillDetail_Create(BillDetail billDetail, int billHeaderId)
       {
           if (billHeaderId == 0)
           {
               ModelState.AddModelError("billHeaderID", "add bill header first");
           }
           if (billDetail != null && ModelState.IsValid)
           {
               var target = new BillDetail
               {
                   Category = billDetail.Category,
                   Description = billDetail.Description,
                   Amount = billDetail.Amount,
                   BillHeaderId = billHeaderId,
                   BillDetailId = SessionBillDetails.Max(d => d.BillDetailId) + 1
               };
 
               //Get next Id in sequence
 
               billDetail.BillDetailId = target.BillDetailId;
 
               SessionBillDetails.Add(target);
           }
 
           return Json(new[] { billDetail }.ToDataSourceResult(new DataSourceRequest(), ModelState));
       }

Can anyone spot an issue, or am I trying to do something that isn't possible?
Thanks.


edited: to add attachment example.
David
Top achievements
Rank 1
 answered on 02 Aug 2013
1 answer
1.3K+ views
I have built an MVC Kendo Helper Grid that needs to display something other than the first page from the DataSource. I set the AutoBind to false, and ServerOperation to true. 

I then have some javascript code which calls the page() function with the number 2, however during this call the controller still receives a  1. What am I doing wrong, or is there another way to set the initial page? Here is the code:

                @(Html.Kendo().Grid<SF_SatAppsMVC4.Models.MD_GetUpcomingMTCEventsResult>().Name("gridUpcomingMTC")
                    .HtmlAttributes(new { @class = "clickableGrid" })
                    .AutoBind(false)
                    .DataSource(datasource => datasource
                    .Ajax()
                    .ServerOperation(true)
                    .PageSize(5)
                    .Read(read => read.Action("GetUpcomingEvents", "ControllerCenter", new { locationID = @ViewBag.locationID })))
                    .Pageable()
                    .Columns(cols =>
                    {
                        cols.Bound(p => p.eventDate).Format("{0:dd-MMM}").Title("Date");
                        cols.Bound(p => p.Presenter);
                     }))

    
<script>
    $(function () {
        debugger;
        $('#gridUpcomingMTC').data("kendoGrid").dataSource.page(2);
    })
</script>
Dimiter Madjarov
Telerik team
 answered on 02 Aug 2013
1 answer
180 views
I see columnResizeHandleWidth in the online javascript documentation, but I can't seem to find it in the MVC framework. I have 2013.2.716 installed.
Dimo
Telerik team
 answered on 02 Aug 2013
2 answers
266 views
The scheduler implementation of the datasource differs from the usage in most of the other Kendo UI widgets.  It doesn't seem to have a data property, which can be used to pass parameters to the controller , to enable custom filtering to be done on the server.

I would like to display two sets of data on one scheduler, and control what is displayed from a drop-down list. This is easy to accomplish with a grid e.g.:-
.DataSource(dataSource=>dataSource
        .Ajax()
        .PageSize(20)
        .Model(m=>
            {
                m.Id(p => p.LogID);
            })
             
         
        .Read(read=>read.Action("GetCRISList","NonDALoads")
        .Data("srchLoad")
        )
        )
        .Pageable(p=>p.Refresh(true))
         .Sortable()
        .Filterable()
 
 
 
  <script type="text/javascript">
 
        var srch = 28;
 
        function selectionChange() {
 
            var dropdownlist = $("#loadDDL").data("kendoDropDownList");
 
            var dataItem = dropdownlist.dataItem();
 
            srch = dataItem.LoadID;
 
            //refresh Grid
            //$("#Grid").data("kendoGrid").dataSource.read();
 
            $('#Grid').data().kendoGrid.dataSource.page(1);
 
        }
 
    function srchLoad() {
        return {
 
 
            ID: srch
        };
    }
 
        </script>

However, I don't seem able to do this with the scheduler.  All I can see is a filter property, but since the data is coming from two different tables, handling the it this way is undesirable.

Currently I have two scheduler widgets in a tab control, but this causes some display issues, and is a bit clunky.

Thanks
AP
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 02 Aug 2013
1 answer
147 views
Hello,
I'm almost at loading data from the api controller. I've got a controller that returns Json from a IEnumerable<Utenti> (POCO object)

I got this exception

Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1502: The best overloaded method match for 'Kendo.Mvc.UI.Fluent.WidgetFactory.Grid(System.Data.DataTable)' has some invalid arguments

Source Error:

Line 7: <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
Line 8:
Line 9: <% Html.Kendo().Grid(Model)
Line 10: .Name("Grid")
Line 11: .AutoBind(true)


my aspx is

  <% Html.Kendo().Grid(Model) //
    .Name("Grid")
    .AutoBind(true)
    //.Columns(columns =>
    //{
    //    columns.Bound(x => x.IDUtente);
    //    columns.Bound(x => x.Nominativo);
    //    columns.Bound(x => x.Societa);
    //    columns.Bound(x => x.Filiale);
    //    columns.Bound(x => x.Ruolo);

    //    //columns.Bound(p => p.).Groupable(false);
    //    //columns.Bound(p => p.ProductName);
    //    //columns.Bound(p => p.UnitPrice);
    //    //columns.Bound(p => p.UnitsInStock);
    //})
        .Groupable()
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read =>
            {
                read.Action("GetListaUtenti", "Administration");
            })
        ).Render();
    %>

My controller is

 [HttpPost]
         public ActionResult GetListaUtenti([DataSourceRequest] DataSourceRequest request)
        {
         //   if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated) throw new SecurityExeption();

            DataAccessAdministration da = new DataAccessAdministration(Global.IDApplication, IDIstituto);

            int idUser = 185560;
            var res = da.GetListaUtenti(idUser);
            return Json(res);
        }

And the Utente item is of that type

 [DataContract]
    public class Utente
    {
        [DataMember]
        public int IDIstituto { get; set; }

        [DataMember]
        public int IDDipendente { get; set; }

        [DataMember]
        public string IDUtente { get; set; }

        [DataMember]
        public string Nominativo { get; set; }

        [DataMember]
        public string Filiale { get; set; }

        [DataMember]
        public string Societa { get; set; }

        [DataMember]
        public string Ruolo { get; set; }

        [DataMember]
        public string Profilo { get; set; }

        [DataMember]
        public string Funzioni { get; set; }

        [DataMember]
        public string Stato { get; set; }

        [DataMember]
        public int IDStato { get; set; }

        [DataMember]
        public int IDFunzione { get; set; }

        [DataMember]
        public int IDProfilo { get; set; }

        [DataMember]
        public Guid? SFGuid { get; set; }
    }

What should I put in the aspx in order to get data loaded?
Thanks

Dimo
Telerik team
 answered on 01 Aug 2013
1 answer
272 views
Hello,

I currently have my resources being retrieved from an action on my controller, however I want to be able to refresh the resources according to a filter (too many rooms to display all at once)

Using the code below I am able to update the datasource, but I can't find a way to refresh the scheduler itself to display the new resources.

Is there a way to do this without doing a full page post?
$('#BookingGrid').data().kendoScheduler.resources[0].dataSource.read()
Ken
Top achievements
Rank 1
 answered on 01 Aug 2013
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Security
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?