Telerik Forums
UI for ASP.NET MVC Forum
10 answers
3.0K+ views

I am using an External ClientTemplate to display some information.  I have created a link out of one of my data values and upon click, I would like to show additional information.  I have this working using the Custom Command action, but the button takes up too much real-estate, hence the new link.  What I cannot figure out is how to perform the same javascript call to accomplish what is working from the Custom Command.

My javascript that works for the Custom Command.

var detailsTemplate = kendo.template($("#statusTemplate").html());
 
function showStatusDetails(e) {
    e.preventDefault();
 
    var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
    var wnd = $("#Details").data("kendoWindow");
 
    wnd.content(detailsTemplate(dataItem));
    wnd.center().open();
}

 

My External ClientTemplate.  Looking for what to replace the ????? with.

<script type="text/x-kendo-template" id="statusRowTemplate">
    <div id="statusContainer">
        <a href="\\#" onclick='showStatusDetails(??????)'><h4 style="height:10px;">#= Description # (#= Code #) </h4></a>
        <div class="dataRow">
            <div class="dataRowField">
                Status Date/Time:
            </div>
            <div class="dataRowValue">
                #= FormattedStatusDateTime #
            </div>
        </div>
        <div class="dataRow">
            <div class="dataRowField">
                Entered By:
            </div>
            <div class="dataRowValue">
                #= EnteredByName #
            </div>
        </div>
    </div>
</script>

 

My grid and window markup

@(Html.Kendo().Grid<Status>()
        .Name("StatusGrid")
        .Columns(columns =>
        {
            columns.Bound(s => s.Code).Title("Status Information").ClientTemplate("#=statusRowTemplate(data)#").HtmlAttributes("style='padding:0px'");
            columns.Command(command =>
            {
                command.Custom("View").Click("showStatusDetails");
                command.Destroy().Text("Delete");
            }).Width(175);
        })
        .DataSource(ds =>
            ds.Ajax()
            .Model(model => model.Id(s => s.StatusID))
            .ServerOperation(false)
            .Read(r => r.Action("ReadStatuses", "ActionPages"))
            .Destroy(destroy => destroy.Action("DeleteStatus", "ActionPages", new { StatusID = "#= Id #" }))
        )
        .Events(e => e.DataBound("dataBound"))
)
 
@(Html.Kendo().Window().Name("Details")
    .Title("Status Details")
    .Visible(false)
    .Modal(true)
    .Draggable(true)
    .Width(500)
)
 
}
Gregory
Top achievements
Rank 1
 answered on 21 Mar 2017
5 answers
363 views

Hello,

I have tried out the Gantt control and moving over to the Scheduler control - I find that the presentation is almost the way I want. However, I want to force events to stick on one row. I display scheduled tasks for multiple employees and want to have both transparency and force tasks / events on a single row and not the way it is displayed in the attached image. Here, overlapping tasks/events will be shown on multiple rows. The grouping works nice, I want to utilize vertical space better by forcing multiple tasks /events into a single row to avoid lenghty scrolling. 

Is this possible with Scheduler control? I used Kendo UI for MVC. 

Veselin Tsvetanov
Telerik team
 answered on 21 Mar 2017
1 answer
294 views

Hi, I have created a project using the MVC5 Grid and Menu template.  When I run the project without any mods, there is a scroll bar on the grid control as expected but also a scroll bar on the browser window.  In order to see the copyright info I have to scroll the browser window.  I assume this is by design?  How do i get the content to fit the browser window without the need for 2 scroll bars?

Also when browsing in IE 11 the page is unresponsive for about 20 seconds but in Chrome and Edge it loads and is responsive instantly.  

Tsvetina
Telerik team
 answered on 21 Mar 2017
1 answer
250 views

I have used UI for ASP.NET MVC in my application and while calling StyleSheetRegistrar, I got error like "System.InvalidOperationException: You cannot call render more than once.". Now on Searching on web i found few solutions and i tried them all but i could not resolve that issue.I have not used ScriptManager in my application. Also i checked and could not find StyleSheetRegistrar().Render() method called twice in my master page. 

Could anybody please help me with this issue?

Note: we have called RenderPartial() method which brings few views during the flow in page but no view or ascx controls contain StyleSheetRegistrar().Render() method called in it.

Konstantin Dikov
Telerik team
 answered on 21 Mar 2017
4 answers
225 views

I am currently evaluating Telerik at the moment and we are currently trying to get our application to use the Grid widget to display a list of "Terms". The grid works semi-nicely when we parse a Model to the partial view and then use the Model with the grid. Model is below;

 

    public class Term
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int TermID { get; set; }
        [Required]
        public string TermName { get; set; }
        public string TermDescription { get; set; }
        public bool Preferred { get; set; }
    }

 

The problem is that there can be an unlimited amount of "Terms" so we have tried to use remote binding. However, when we use remote binding, the Grid widget doesn't show up at all. The method in the controller gets the data, and the browser seems to retrieve the json (according to Fiddler).

Controller Method

        public ActionResult _TermTable([DataSourceRequest]DataSourceRequest request)
        {
            using (IVContext db = new IVContext())
            {
                return Json(db.Terms.ToDataSourceResult(request),JsonRequestBehavior.AllowGet);
            }
        }

Partial View

@(Html.Kendo().Grid<DemoSpace.Models.Term>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.TermID);
        columns.Bound(p => p.TermName);
        columns.Bound(p => p.TermDescription);
        columns.Bound(p => p.Preferred);
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .ServerOperation(true)
        .Read(read => read.Action("_TermTable", "Admin"))
     )
)

I know that I am going to be missing something obvious, but I just can't see it.

 

Any and all help is appreciated.

 

Johannes
Top achievements
Rank 1
Veteran
 answered on 21 Mar 2017
1 answer
577 views

I have a form with a Kendo UI MultiSelect component for ASP.NET MVC / Razor:

@(Html.Kendo().MultiSelectFor(m => m.Ids) .Filter(FilterType.Contains) .AutoBind(true) .MinLength(3) .Delay(500) .DataTextField("Value") .DataValueField("Key") .Placeholder("Please fill") .DataSource( ds => ds.Read( r => r.Action("FillMultiSelect", "ReportsController", new { companyId = IdentityManager.CompanyID, search = string.Empty }) ).ServerFiltering(true) ) )

JavaScript for filtering:

var $ids = $("#Ids").data("kendoMultiSelect"); $ids.dataSource.transport.options.read.data = basicFilter($ids); var basicFilter = function ($element) { return { companyId: self.form.getModel().CompanyId, search: $element.input.val() } }

When I type the search text at the "Ids" MultiSelect, the parameter passed to the ASP.NET MVC Action is the value of the placeholder of the element (see attached images).

What's wrong with my code?

I have posted the same question Stack Overflow: http://stackoverflow.com/questions/42844737/kendo-multi-select-component-passing-placeholder-as-value

 

Ianko
Telerik team
 answered on 20 Mar 2017
7 answers
1.1K+ views

Dear all,

I had followed this useful link Remote Validation to apply the remote validation on MetaData class as follows;

Metadata

public class CoinMetadata
{
    [Required(ErrorMessageResourceType = typeof(Errors), ErrorMessageResourceName = "NameReq")]
    [Display(Name = "CoinName", ResourceType = typeof(ScreenRes))]
    [Remote("IsValidName", "Coin", ErrorMessageResourceType = typeof(Errors), ErrorMessageResourceName = "NameDuplicate")]
    // AdditionalFields="coin_id", ErrorMessageResourceType = typeof(Errors), ErrorMessageResourceName = "NameDuplicate")
    public string name { get; set; }
}

 

The Controller:

public JsonResult IsValidName(string name)
{
    bool found = db.IGL_coin.Any(name => name.name == name);
    if (!found)
    {
        return Json(true, JsonRequestBehavior.AllowGet);
    }
    return Json(false, JsonRequestBehavior.AllowGet);
}

The error message from resource file doesn't show up, instead It shows false.

How can I make it works?

Stefan
Telerik team
 answered on 20 Mar 2017
1 answer
120 views

Hi, the date filtering does not appear to be working.  I am in the UK and i have formatted the datepicker to be dd/MM/yyyy but when the data is being filtered it is not working correctly.  Is there a quick fix for this.  Also if you type into the datepicker and press enter should the grid data update?  

 

Thanks Graham

Tsvetina
Telerik team
 answered on 20 Mar 2017
1 answer
224 views

I'm using the bootstrap theme, although I am not using Bootstrap itself.  My form fields and buttons, such as on the Kendo menu and panel bar, when selected have a blue glowing halo around it.  I was able to modify it for the inputs with 

input:focus
{
        outline: thin dotted;
        /*outline: 5px auto -webkit-focus-ring-color;*/
        outline: 2px auto #fe9827;
        outline-offset: -2px;
}

 

but this doesn't alter the color (which is what I really want) for the Kendo menu and panelbar.  How can I accomplish that please?

Orlin
Telerik team
 answered on 20 Mar 2017
6 answers
289 views

Dear All,

I have a treeview & listview in different spliter panes.

I successfully retrieved the tree-view data, what I want now is to display the related items of the selected tree-view node.

here is what I have so far:

@(Html.Kendo().Splitter()
     .Name("RefFilesSplitter")
     .HtmlAttributes(new { @style = "height:100%;" })
     .Panes(panes =>
         {
            panes.Add()
                .Size("310px")
                .Collapsible(true)
                .Content(
                    @<div id="RefFiles">
                    @(Html.Kendo().TreeView()
                        .Name("TVtoc")
                        .HtmlAttributes(new { @style = "height:100%;width:100%" })
                        .DragAndDrop(true)
                        .DataTextField("Name")
                        .DataSource
                        (dataSource => dataSource
                            .Read(read => read.Action("GetGroups", "TreeOfAccounts"))
                            .Model(m => m.Id("GroupId"))
                            .Events(e => { e.RequestEnd("requestEndHandler"); })
                        )
                        .Events(e => e.Select("onSelect"))
                    )
                    </div>);
            panes.Add()
                .Content(
                    @<div id="RefFilesContent">
                    @(Html.Kendo().ListView<IdeaGL.Models.IGL_account>()
                    .Name("LVAccounts")
                    .HtmlAttributes(new { @style = "height:100%;width:100%" })
                    .ClientTemplateId("template")
                    .TagName("div")
                    .DataSource
                        (dataSource => dataSource
                            .Read(read => read.Action("GetAccounts", "TreeOfAccounts", new  {groupid=Model.GroupId}))
                            .Model(m => m.Id("account_id"))
                        )
                        .Pageable()
                    )
                </div>);
         })
    )

 

and here is the JavaScript OnSelect:

function onSelect(e)
{
     
    // this doesn''t work ...
    $("#LVAccounts").data("kendoListView").dataSource.read();
    $("#LVAccounts").data("kendoListView").refresh();
 
    var data = $('#TVtoc').data('kendoTreeView').dataItem(e.node);
     
    $.ajax({
        url: "/TreeOfAccounts/GetAccounts?groupid=" + data.id
    }).success(function ()
    {
        // what should i do here !!
    })
}

 

I can see how to make the listview refresh the data for the selected treeview node.

any help ?

Ianko
Telerik team
 answered on 20 Mar 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?