Telerik Forums
UI for ASP.NET MVC Forum
5 answers
1.2K+ views

Using the MVC menu I cant get rid of the text color style on hover.  It seems something is firing on JQuery when the item is hovered.  Its appending k-state-hover, which is setting the color property somewhere in the kendo style sheets.

I've tried to get rid of if using

 

#topmenu li .k-state-hover         

{         

color: #fdfdfd;   

    }​

or

#topmenu .k-state-hover         
{         
color: #fdfdfd;   
    }​​

with no luck.  Any ideas?
Yngve
Top achievements
Rank 1
 answered on 09 May 2017
1 answer
246 views
I would like to ask if there are any examples for the following: I wish to display something like a loading panel or a wait cursor when  retrieving data from the database and rendering pie chart.
Stamo Gochev
Telerik team
 answered on 09 May 2017
1 answer
247 views

I have a dynamic grid that I'm binding to the server. Since InCell editing is not available for with Server binding, I had to go to InLine with the Edit Button. When my grid renders I notice that no matter where I put the Edit Button, at the beginning or end of my list of columns, it's cut in half. I also noticed that there is no horizontal scrolling.

Here is my Razor view, attached is what I see after the grid renders. Has anyone seen this behavior before and how they fixed it?

@using SOCKETWorx.Site.Models
@model GridDynamicViewModel
 
@{
    ViewBag.Title = Model.ModuleName;
    Layout = "~/Views/Shared/_Layout.cshtml";
}
 
<p>
    @Html.ValidationSummary(true, "", new { @class = "text-danger", id = "ValidationMessenger" })
</p>
<p>
    @(Html.Kendo().DropDownList()
        .Name("dropdownlist_GridViews")
        .DataTextField("Value")
        .DataValueField("Id")
        .HtmlAttributes(new { style = "width:300px" })
        .Events(e => e.Change("GridViews_OnChange"))
        .Value(Convert.ToString(Model.ViewId))
        .DataSource(source => source
            .Custom()
            .Group(g => g.Add("TypeName", typeof(string)))
            .Transport(transport => transport
                .Read(read =>
                {
                    read.Action("GridView_Read", "Data").Data("OnAdditionalData");
                }))
        )
    )                           
    @(Html.Kendo().Button()
        .Name("button_CreateView")
        .HtmlAttributes(new { type = "button" })
        .Content("Create New View")
        .Events(ev => ev.Click("CreateView_onClick")))
    @(Html.Kendo().Button()
        .Name("button_EditView")
        .HtmlAttributes(new { type = "button" })
        .Content("Edit View")
        .Events(ev => ev.Click("EditView_onClick")))
    @(Html.Kendo().Button()
        .Name("button_CloneView")
        .HtmlAttributes(new { type = "button" })
        .Content("Clone View")
        .Events(ev => ev.Click("CloneView_onClick")))
    <span id="span_ToolTip" style="color: transparent">View</span>
    <hr/>
    @(Html.Kendo().Grid(Model.TheData)
        .Name("grid_GridList")
        .Columns(columns =>
        {
            columns.Command(command => { command.Edit(); });
            if (Model.GridColumns != null)
            {
                columns.Bound(p => p.Id).Hidden();               
                foreach (ColumnSettings col in Model.GridColumns)
                {
                    columns.Bound(col.PropertyName).Title(col.Title).Width(col.Width);
                }               
            }
        })
        .ToolBar(toolbar =>
        {
            toolbar.Custom().Text("Export To Excel").Action("GenerateReport", "Chart", new { moduleId = Model.ModuleId, viewId = Model.ViewId });
            toolbar.Custom().Text("Spreadsheet Mode").Action("Spreadsheet", "Data", new { moduleId = Model.ModuleId, viewId = Model.ViewId });
        })
        .Editable(editable => editable.Mode(GridEditMode.InLine))
        .HtmlAttributes(new { style = "height:75vh" })
        .Sortable()
        .Scrollable()
        .Resizable(r => r.Columns(true))
        .Filterable()
        .Groupable()
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(false)
            .ButtonCount(5)
        )
        .Events(events =>
        {
            events.DataBound("OnDataBound");
            events.Group("OnGroup");
        })
        .DataSource(dataSource => dataSource
            .Server()
            .PageSize((int)ViewBag.UserInfo.GridSize)
            .Model(model =>
            {
                model.Id(p => p.Id);
                if (Model.GridColumns != null)
                {
                    foreach (ColumnSettings col in Model.GridColumns)
                    {
                        model.Field(col.PropertyName, col.ColType).Editable(col.Editable);
                    }
                }
            })
            .Read(read => read.Action("List", "Data"))
            .Update(update => update.Action("GridList_Update", "Data"))
        )
    )
</p>
 
@(Html.Kendo().Tooltip()
    .For("#span_ToolTip")
    .Content(Model.ToolTip)
    .Position(TooltipPosition.Right)
    .AutoHide(true)
    .Width(650)
)
 
<script type="text/javascript">   
    $(document).ready(function () {
        try {
            var showGrid = "@Model.ShowGrid";
            if (showGrid.toLowerCase() == "false") {
                $("#grid_GridList").hide();
            }
            else {
                $("#grid_GridList").show();
            }
 
            var canEdit = "@Model.CanEditView";
            if (canEdit.toLowerCase() == "true") {
                $("#button_EditView").show();
            }
            else {
                $("#button_EditView").hide();
            }
 
            var toolTip = @Html.Raw(Json.Encode(Model.ToolTip));
            if (toolTip != "") {
                $("#span_ToolTip").show();
            }
            else {
                $("#span_ToolTip").hide();
            }
 
            var showGridViewControls = "@ViewBag.ShowGridViewControls";
            if (showGridViewControls.toLowerCase() == "false") {
                $("#dropdownlist_GridViews").closest(".k-widget").hide();
                $("#button_CreateView").hide();
                $("#button_CloneView").hide();
            }           
        }
        catch(err) {
            $("ValidationMessenger").text(err);
        }
    });
 
    function GridViews_OnChange() {
        var viewId = $("#dropdownlist_GridViews").val();
        if (viewId == "0" || viewId == "") {
            $("#grid_GridList").hide();
        }
        else {
            $("#grid_GridList").show();
            location.href = '@Url.Action("List", "Data")?moduleId=' + @Model.ModuleId + '&viewId=' + viewId;
        }
    }
 
    function OnAdditionalData() {
        var moduleId = "@Model.ModuleId";
        var viewId = $("#dropdownlist_GridViews").val();
        return {
            moduleId,
            viewId,
        };
    }
 
    function OnDataBound(e) {
        var isCadWorx = "@Model.IsCadWorx";
        if (isCadWorx.toLocaleLowerCase() == "false") {
            var that = this;
            $(that.tbody).on("dblclick", "tr", function (e) {
                var rowData = that.dataItem(this);
                location.href = '@Url.Action("Detail", "Data", new {values = "val1" })'.replace("val1", rowData.Id);
            });
        }
    }
 
    function OnError(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            $("ValidationMessenger").text(message);
        }
    }
 
    function OnGroup(arg) {
        var groupByFields = [];
        for (iCount = 0; iCount < arg.groups.length; iCount++) {
            groupByFields[iCount] = arg.groups[iCount].field;
        }
 
        $.ajax({
            type: "POST",
            url: '@Url.Action("UpdateViewGroupedBy", "Data")',
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify({ fields: groupByFields, viewId: @Model.ViewId }),
            dataType: "json",
            success: function (result) {
                if (result.status != "Success") {
                    var msg = $("#ValidationMessenger");
                    if (msg) {
                        msg.text(result.message);
                    }
                }
            },
            error: function () {
                var msg = $("#ValidationMessenger");
                if (msg) {
                    msg.text(result.message);
                }
            }
        });
    }
 
    function CreateView_onClick() {
        location.href = '@Url.Action("Index", "ViewManager")?gridviewaction=3&moduleId=' + '@Model.ModuleId' + '&viewId=';
    }
 
    function EditView_onClick() {
        var viewId = $("#dropdownlist_GridViews").val();
        location.href = '@Url.Action("Index", "ViewManager")?gridviewaction=5&moduleId=' + '@Model.ModuleId' + '&viewId=' + viewId;
    }
 
    function CloneView_onClick() {
        var viewId = $("#dropdownlist_GridViews").val();
        location.href = '@Url.Action("Index", "ViewManager")?gridviewaction=2&moduleId=' + '@Model.ModuleId' + '&viewId=' + viewId;
    }
</script>
Stefan
Telerik team
 answered on 08 May 2017
1 answer
147 views

I am seeking help to understand the documentation found here:

http://demos.telerik.com/aspnet-mvc/treelist/remote-data-binding

My questions are:

In the following snip it 

public JsonResult Create([DataSourceRequest] DataSourceRequest request, EmployeeDirectoryModel employee)

{

if (ModelState.IsValid)

{

employeeDirectory.Insert(employee, ModelState);

}

return Json(new[] { employee }.ToTreeDataSourceResult(request, ModelState));

}

In this example the purpose is to create (insert) a new record. To do this this function calls the Insert method of the employeeDirectory method (which is presumable a method of the EmployeeDirectoryModel and it takes two parameters the employee (which was passed into this calling function, and the ModelState.

My question is, what does this Insert method do with the ModelState? It is passed in for a reason, so what is that reason?

The employee parameter will contain the data to be written to the database, except the primary key, does the Insert method load the primary key value into the model so that when it gets returned back (last line of snip it), there will be a fully loaded employee object?

When, where, how, does the ModelState get updated so that it knows that the employee object is full validated (i.e. has a primary key)?

Thank you

Alex Hajigeorgieva
Telerik team
 answered on 08 May 2017
1 answer
417 views

Hi,

I've been looking for a way to persist a grid's options, specifically page, page size, sort, filter, and group options, to the URL, in order to make shareable URLs that will set the grid data automatically.

I found this post and the referenced example, which I also found on Github, but unless I'm missing something big, this example simple serializes the options to the URL, but it never configures the grid with the options passed in the URL.

Still, inspired by this example, I experimented by manually parsing the URL. It took me a while to figure out that I have to allow a first binding before I can change settings such as page or page size, but I got that working. My problem now is the filter. A filter object is serialized into something like 'category~eq~somecat' and I can't figure out how to convert it back into an object that I can pass back to the query method. I guess I'll have similar problems with sorting and grouping.

Is there a built-in method to convert back the values serialized in the samples I mentioned? Or a sample that shows how to do this?

Thanks in advance,

Mauricio

Stefan
Telerik team
 answered on 08 May 2017
19 answers
1.3K+ views
Hello!  I'm utilizing a multiselect widget within a detail template for a standard grid.

Currently, the widget loads and can be interacted with just fine, but I can't seem to load default values into from the model.  When the detail template is opened, no values are selected and just the placeholder text is present.  Let me know if you require any more info.  Thanks!

Current Build: v2013.1.514

Code inside the detail template (Does NOT work):
<table>
    <tr valign="top">
        <td style="width:1%;">@Html.Label("RoleOperations", "Operations")</td>
        <td>
            @(Html.Kendo().MultiSelect()
                .Name("AuthRoleOperationMultiselect_#=RoleID#")
                .BindTo(ViewBag.AuthOperationListing)
                .Placeholder("Select Operations...")
                .DataTextField("Description")
                .DataValueField("ID")
                .Value("#=AuthOperationIDs#") //Type: List<int>
                .ToClientTemplate()
            )
        </td>
    </tr>
</table>

Code outside detail template (DOES work):
@(Html.Kendo().MultiSelect()
    .Name("AuthRoleOperationMultiselect")
    .Events(events =>
    {
        events.DataBound("ConfigureMultiselect");
    })
    .BindTo(ViewBag.AuthOperationListing)
    .Placeholder("Select Operations...")
    .DataTextField("Description")
    .DataValueField("ID")
    //Just selecting the info of the first item in the grid
    .Value(Model.AdminModel.AuthorizationModel.AuthRoleOperationList[0].AuthOperationIDs) //Type: List<int>
)


Grid Code + Detail Template code:
<div id="AuthRoleOperationContainer">
    <h3 style="margin:1px;">Roles & Operations</h3>
    @(Html.Kendo().Grid(Model.AdminModel.AuthorizationModel.AuthRoleOperationList)
        .Name("AuthRoleOperationGrid")
        .Columns(columns =>
        {
            columns.Bound(i => i.Description);
            columns.Command(command =>
            {
                command.Destroy();
            }).Width(100);
        })
        .ClientDetailTemplateId("AuthRoleOperationDetails")
        .ToolBar(toolbar =>
        {
            toolbar.Template(@<text>
                <a class="k-button k-button-icontext k-grid-add" href="#_">
                    <span class="k-icon k-add"></span>Add new item
                </a>
                <a class="k-button k-button-context" onclick="SaveAuthRoleOperations();" href="#">
                    <span class="k-icon k-add"></span>Save changes
                </a>
                <a class="k-button k-button-icontext k-grid-cancel-changes" href="#">
                    <span class="k-icon k-cancel"></span>Cancel changes
                </a>
            </text>);
        })
        .Editable(editable => editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom))
        .Navigatable(navigatable => navigatable.Enabled(true))
        .Pageable()
        .Sortable()
        .Filterable()
        .Resizable(resize => resize.Columns(true))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Batch(true)
            .ServerOperation(false)
            .Sort(sort => sort.Add("Description").Ascending())
            .Model(model =>
            {
                model.Id(i => i.RoleID);
            })
            .Read(read => read.Action("GetAuthRoleOperations", "Authorization"))
            .Create(create => create.Action("CreateAuthRoleOperations", "Authorization"))
            .Update(update => update.Action("UpdateAuthRoleOperations", "Authorization"))
            .Destroy(destroy => destroy.Action("DeleteAuthRoleOperations", "Authorization"))
        )
    )
</div>
 
<script id="AuthRoleOperationDetails" type="text/kendo-tmpl">
    @Html.Partial("DetailTemplates/AuthRoleOperationDetails")
</script>

Konstantin Dikov
Telerik team
 answered on 08 May 2017
1 answer
341 views

Hi,

 

I have a treelist where I want to show a tooltip when you hover over a certain span tag inside one of the columns. The span is added to the column via the .templateId - function.

 

Here is the Code for what I'm trying to do. The problem is I don't get the (Html.Kendo().Tooltip() function to bind the tooltip functionality to the span when the span is generated via the templateId function. If I just make a span anywhere else outside the treelist it works fine. The spans all have their own id : "tooltip_0" etc. How would I go about implementing this?

 

 

 

 

 

Konstantin Dikov
Telerik team
 answered on 08 May 2017
3 answers
379 views
 
 
@model TemplatesViewModel
 
@{
    ViewBag.Title = "Create Item Req";
}
 
 
 
<script type="text/x-kendo-tmpl" id="popupTemplate">
    <div class="pop-product-view">
        <dl>
            <dt>Item Number</dt>
            <dd> #:ItemNbr#</dd>
            <dt>Description</dt>
            <dd>#:Descr#</dd>
            <dt>Quantity</dt>
            <dd>#:Qty#</dd>
        </dl>
        <div class="pop-edit-buttons">
            <a class="k-button k-edit-button" href="\\#"><span class="k-icon k-i-edit"></span></a>
            <a class="k-button k-delete-button" href="\\#"><span class="k-icon k-i-delete"></span></a>
        </div>
    </div>
</script>
 
<div class="modal-body">
 
    @using (Ajax.BeginForm("TestAjaxForm", "WFAction", FormMethod.Post,
                                        new AjaxOptions
                                        {
                                            HttpMethod = "POST",
                                            OnBegin = "onBegin",
                                            OnSuccess = "onSuccess",
                                            OnFailure = "onFailure",
                                        })
 
            )
    {
 
        @(Html.EditorForField(m => m.Descr))
 
        @(Html.EditorForField(m => m.VendorID))
 
 
        <br />
        <a class="k-button k-button-icontext k-add-button" href="#"><span class="k-icon k-i-add"></span>Add Item</a>
 
            @(Html.Kendo().ListView<ItemsViewModel>()
                               .Name("listView")
                               .TagName("div")
                               .BindTo(Model.Items)
                               .ClientTemplateId("popupTemplate")
                               .DataSource(dataSource => dataSource
                                   .Model(m => {
                                       m.Id(f => f.ItemNbr);
                                       m.Field(f => f.Descr);
                                       m.Field(f => f.Qty);
                                    })
                                   .PageSize(4)
                                    
                                   .Create(create => create.Action("Editing_Create", "WFAction"))
                                   .Read(read => read.Action("Editing_Read", "WFAction"))
                                   .Update(update => update.Action("Editing_Update", "WFAction"))
                                   .Destroy(destroy => destroy.Action("Editing_Destroy", "WFAction"))
                               )
                                
                               .Pageable()
                               .Editable(e => e.Enabled(true).TemplateName("ListViewKendoEditTemplate"))
            )
 
 
        <button id="save" type="submit">Save</button>
            @*@(Html.Kendo().Button().Name("submitFormButton").Content("Save").Events(e => e.Click("onSubmitFormClick")))*@
    }
 
</div>
// The editor template
 
@model ItemsViewModel
 
 
 
    <div class="pop-product-view">
        <dl>
            <dt>Item</dt>
            <dd>
                   <input name="ItemNbr" data-source="items" data-role="dropdownlist" data-text-field="Descr" data-value-field="ItemNbr" />
            </dd>
            @*<dt>Description</dt>
            <dd>#:Descr#</dd>*@
            <dt>Quantity</dt>
            <dd>
               @(Html.EditorForField(m => m.Qty)) @*<input type="text" class="k-text" data-bind="value:Qty" name="#:Qty#" />*@
            </dd>
        </dl>
        <div class="pop-edit-buttons">
            <a class="k-button k-button-icontext k-update-button" href="\\#">Save Item</a>
            <a class="k-button k-button-icontext k-cancel-button" href="\\#">Cancel</a>
        </div>
    </div>

 

The editor template works and it writes the data back into the display template but I want the data in the ListView to bind to the TemplatesViewModel's property Items which is an IEnumerable of ItemsViewModel. When I get the data back in the controller it isn't binding to the Model but the other fields are binding fine for the Descr and VendorID.
Viktor Tachev
Telerik team
 answered on 05 May 2017
1 answer
343 views

Hi,

I am trying to edit a cell inline. When there is an error in the update controller, the model state returns an error but the cell value gets changed to the edited value which threw error. I want to retain the earlier value if there are any errors in the model state without calling the data source read() method.

Is there any way to achieve this?

 

Thank you.

Veselin Tsvetanov
Telerik team
 answered on 05 May 2017
3 answers
396 views

I have the Kendo UI grid setup with one column that has a Date datatype. The filter menu comes up correctly (extras: true) with two Date Picker widgets, what I'm trying to do is default the value in the textbox in the first widget to the first of the month and the second textbox to be set to the last day of the month as soon as the filter menu is opened.

I haven't been able to find any examples on how to set this, any info would be much appreciated.

Thanks.

 

 

Preslav
Telerik team
 answered on 05 May 2017
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
Security
ColorPicker
DateRangePicker
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
DropDownButton
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
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
LLM Kit
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?