Telerik Forums
UI for ASP.NET MVC Forum
4 answers
202 views
Hello,

I have a Dropdown with themes  and when changed i dynamically Change theme of Kendo Scheduler. Doing so works fine in Firefox and Safari Browsers but Problem Comes on IE 11 browser. The theme is changed successfully but the Scheduler Navigation arrow is missing and also the calendar Icons for datetimepicker is missing. Attached the Images how it Looks on FF and IE 11.
Here is the jquery method for dynamic theme Change.

function ResetTheme(data) {       
var skinName = data;
        //alert(skinName);
        var skinRegex = /kendo\.[\w\-]+(\.min)?\.(.+)/i;
        var themeLink = $("head link").filter(function () {
            return (/kendo\./gi).test(this.href) && !(/common|rtl|dataviz/gi).test(this.href);
        });        var currentThemeUrl = themeLink.attr("href");
        var newThemeUrl = currentThemeUrl.replace(skinRegex, "kendo." + skinName + "$1.$2");        var newLink,
            doc = document,
exampleElement = $("#example"),
less = window.less,
isLess = /\.less$/.test(themeLink.attr("href"));
        if (kendo.support.browser.msie && kendo.support.browser.version < 11) {
            newLink = $(doc.createStyleSheet(newThemeUrl));
        } else {
            newLink = themeLink.eq(0).clone().attr("href", newThemeUrl);
            themeLink.eq(0).before(newLink);
        }
       // alert(currentThemeUrl + ' ' + newThemeUrl);
        themeLink.remove();
        if (isLess) {
            $("head style[id^='less']").remove();            less.sheets = $("head link[href$='.less']").map(function () {
                return this;
            });            less.refresh(true);
        }
        if (exampleElement.length) {
            exampleElement[0].style.cssText = exampleElement[0].style.cssText;
        }
    };
Let me know how can i fix it for IE 11 browser.

Thanks

Anamika
Dimo
Telerik team
 answered on 01 Dec 2014
4 answers
188 views
Hello,

I am using customeditortemplate for scheduler. And i have ObjectID as hiiden field and ObjectDescription as text field there like this.
<div data-container-for="ObjectID" class="k-edit-field">
    
    @(Html.TextBoxFor(model => model.ObjectDesc, new { @class = "k-textbox" , data_bind = "value:ObjectDesc",style="width:68%;",Name="txtObjDesc"}))
<input class="k-button" id="searchBtn" style="width:20px" type="button" value="...." onclick="TestClick(this)" />
     
     @(Html.TextBoxFor(model => model.ObjectID, new { @class = "k-textbox", data_bind = "value:ObjectID",Name="txtObjectID",style="display:none" }))
    <span class="k-invalid-msg" data-for="ObjectID"></span>
    </div>

When i load scheduler i have lastselected ObjectID and the popup editor must come with ObjectID pre-filled. So this is how my scheduler_edit event looks
 function scheduler_edit(e) {
       
     
        if (e.event.isNew()) {
            
            var rootDir = "@Url.Content("~/")";

            var queryStringColl = getQueryStrings();
            var objectid = queryStringColl['objectid'];

            if (objectid) {
                
                $.ajax({
                    url: rootDir + "Objekt/LoadAdress",
                    cache: false,
                    async: false,
                    data: {
                        strSelectedObjectID: objectid
                    },
                    success: function (data) {
                        if (data.result == "Error") {
                            alert(data.message);
                        } else {
                            e.event.set("ObjectDesc", data.objectDesc);
                            e.event.set("ObjectID", data.objectid);
                            e.event.set("AdressID", data.AdressID);
                            e.event.set("contactID", data.ContactID);
                            e.event.set("LetterHead", data.LetterHead);
                        }
                    }
                });
            }
        }
    }
When the addwindow comes up i see value for ObjectDesc and rest all but ObjectID is not filled. though objectid has value.
Not sure what is the problem. The ObjectID field is required as well .

Thanks

Anamika
Georgi Krustev
Telerik team
 answered on 01 Dec 2014
7 answers
222 views
I am trying the scheduler for an MVC application and I have a strange comportment with Internet Explorer 11 version:11.0.9600.17358 
I put scheduler in splitter and I have a function who resize the scheduler on changing size of splitter, see a simple example on this attached project. 
On opening Event and changing RecurrenceRule the Event windows close brutally. 
This happening after publishing only in Explorer 11 version:11.0.9600.17358 
Have you any idea?
Thanks by advance.
Georgi Krustev
Telerik team
 answered on 01 Dec 2014
2 answers
415 views
Hi,

I'm trying to bind to a model image in the DetailTemplate but am unable to, I receive the following error Inline markup blocks (@<p>Content</p>) cannot be nested. Only one level of inline markup is allowed.

I could use a helper function as described in the link below:

http://stackoverflow.com/questions/10684025/inline-markup-blocks-cannot-be-nested-only-one-level-of-inline-markup-is-allowe

But unsure of how to set the @item.Orders I have tried a local variable as a ICollection but this doesn't work.

Any idea how I can get the code below to work?

@model IEnumerable<GridScenario.Models.Employee>

@{ Html.Kendo().Grid(Model)
    .Name("Employees")
    .Columns(columns =>
    {
        columns.Bound(e => e.FirstName).Width(140);
        columns.Bound(e => e.LastName).Width(140);
        columns.Bound(e => e.Title).Width(200);
        columns.Bound(e => e.Country).Width(200);
        columns.Bound(e => e.CountryFlag)
            .Template(@<text><img alt="Static Image Alt Text" src="@Url.Content(@item.CountryFlag) " />
            </text>);

        @*.Template(@<text>
        <img alt="Static Image Alt Text" src="@Url.Content("~/Images/usa.png") " />
        </text>);*@
        
        columns.Bound(e => e.City);
    
    })
    .DetailTemplate(
    @<text>
        
        @(Html.Kendo().Grid(item.Orders)
                    .Name("Orders_" + item.EmployeeID)
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.OrderID).Width(101);
                        columns.Bound(o => o.ShipCountry).Width(140);
                        columns.Bound(o => o.ShipAddress).Width(200);
                        columns.Bound(o => o.ShipName).Width(200);
                        columns.Bound(o => o.ShippedDate).Format("{0:d}");
                        columns.Bound(o => o.CountryFlag).Template(@<text><img alt="Static Image Alt Text" src="@Url.Content(@item.CountryFlag) " />
                        </text>);

             
                    })
                    .DataSource(dataSource => dataSource.Server())
                    .Pageable()
                    .Sortable()
                    .Filterable()
        )
    </text>
)
    .RowAction(row =>
    {
        if (row.Index == 0)
        {
            row.DetailRow.Expanded = true;
        }
        else
        {
            var requestKeys = Request.QueryString.Keys.Cast<string>();
            var expanded = requestKeys.Any(key => key.StartsWith("Orders_" + row.DataItem.EmployeeID) ||
                key.StartsWith("OrderDetails_" + row.DataItem.EmployeeID));
            row.DetailRow.Expanded = expanded;
        }
    })
    .Pageable()
    .DataSource(dataSource => dataSource.Server().PageSize(5))
    .Sortable()
    .Render();
}

Tausif
Top achievements
Rank 1
 answered on 01 Dec 2014
5 answers
170 views
Model

public class Switch
{
    [DisplayName("Switch Id")]
    public string SwitchId { get; set; }
}

Controller
public class UserConsoleViewModelsController : Controller
{
    public ActionResult FilteredSwitches_Read([DataSourceRequest]DataSourceRequest request)
    {
        var filteredSwitches = GetFilteredSwitches().ToDataSourceResult(request);  //3 records are here at runtime
        return Json(filteredSwitches);
    }
 
    private IEnumerable<Switch> GetFilteredSwitches()
    {
        return db.Switches.ToList();
    }
}

View

@(Html.Kendo().Grid<Switch>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(c => c.SwitchId).Width(140);
    })
    .HtmlAttributes(new { style = "height: 380px;" })
    .Scrollable()
    .Groupable()
    .Sortable()
    .Pageable(pageable => pageable
        .Refresh(true)
        .PageSizes(true)
        .ButtonCount(5))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("FilteredSwitches_Read", "UserConsoleViewModels"))
    )


I get a grid, but there are no rows in it for the 3 records known to be in 'FilteredSwitches_Read()'.

What am I doing wrong?

Dave
Dimiter Madjarov
Telerik team
 answered on 01 Dec 2014
2 answers
306 views
I have a Kendo UI MVC Menu which I created dynamically using code from this link - my code is below.
When I select a menu option I want to call an Ajax request to load some report details on the page. Note in my code I have menuItemOption1 and menuItemOption2 (this one is commented out) I have two queries:

1. Using menuItemOption1 which sets the Action i.e. .Action("GetReports", "Reports",new {Oid=child.Oid}); I want to be able to retrieve this Action Url in the 'reportSelectChanged' javascript function to use in the Ajax request - how do I get the generated Action url in the javascript function I can get the menu item text using javascript below:

$(e.item).children(".k-link").text();

But how do I access the action url parameter?

2. In menuItemOption2 I was trying to dynamically add a html data attribute i.e. data-reportoid - then in my javascript function I'd like to access this data attribute. The Kendo UI MVC MenuBuolder is fine with the first parameter - so code below works fine:

var menuItemOption2 = menuItems.Add().Text(child.Text).HtmlAttributes(new {@id=child.Oid.ToString()});

However when I add the second data attribute I get the compiler error below when the browser tries to render the razor page. Is it possible to set the data attribute dynamically and if it is how do I get it i the javscript function.

Compiler Error Message: CS0746: Invalid anonymous type member declarator. Anonymous type members must  be declared with a member assignment, simple name or member access.






@model IList<ModelMenuItem>
@functions
{
    public void addCategoryChildren(MenuItemBuilder builder, string parentCategory, IList<ModelMenuItem> items)
    {
        var children = items.Where(m => m.Category == parentCategory);
        if (children != null)
        {
            builder.Items(menuItems =>
            {
                foreach (var child in children)
                {
                    var menuItemOption1 = menuItems.Add().Text(child.Text).Action("GetReports", "Reports",new {Oid=child.Oid});
                    //var menuItemOption2 = menuItems.Add().Text(child.Text).HtmlAttributes(new {@id=child.Oid.ToString(), data-reportoid=child.Oid.ToString()});
                }
            });
        }
    }
}
@{ 
    var categories = Model.Select(x => x.Category).Distinct().ToList();
}
 
<div id="workflowToolbar">
    @(Html.Kendo().Menu()
        .Name("mnuReports")
        .Items(topMenu =>
        {
            foreach (var cat in categories)
            {
                var builder= topMenu.Add().Text(cat.ToString());
                addCategoryChildren(builder, cat.ToString(), Model);
            }
        })
        .Events(e=>e.Select("reportSelectChanged"))
        )
</div>









Daniel
Telerik team
 answered on 01 Dec 2014
1 answer
116 views
Hi, I need to filter the Grid through a Client DataSource in client side.
I can filter the grid applying the filter to the grid directly, however it is not possible filter using non visible columns, so I tried to apply a filter the grid adding filter expressions in the ClientDataSource but nothing happens.
For example
    var datasource = $find('MyClientDataSource');
    datasource.get_filterExpressions().add({ fieldName: "MyField", value: "MyValue", operator:Telerik.Web.UI.ClientDataSource.FilterOperator.EqualTo });
    tableView.rebind();

This code doesnt work. It is possible do this kind of filtering?
Ricardo
Top achievements
Rank 1
 answered on 28 Nov 2014
1 answer
131 views
Hi ,

Can we able to use kendo validator in gantt for making validation in the gantt list view while editing?

Regards,
Manoj
Kiril Nikolov
Telerik team
 answered on 28 Nov 2014
1 answer
403 views
I want to print the window contents on window open.  Is there a way to do this?  Thanks.
Dimo
Telerik team
 answered on 28 Nov 2014
1 answer
106 views
Hello.
I tried to find a solution on the forum, but did not find.

I have a treeview with tempate - 

<script id="treeview-template" type="text/kendo-ui-template">
    #: item.text #    
    <span><input class="color" value="1" /></span>
    <a class="k-button appendNodeToSelected" href='\#'>Append node</a>
    <a class='k-button delete-link' href='\#'>Remove node</a>
</script>

input in js I transforamtion to kendo dropdown.

And when I select a node there is an error in the file 'kendo.all.min.js'
error : 
TypeError: e is undefined>....each(function(){var e=i.dataItem(this);e.set("selected",!1),delete e.selected}).

If i remove input, all work OK. Help resolve this problem. Because with this error I can't add Node.







Alex Gyoshev
Telerik team
 answered on 28 Nov 2014
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
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
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
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?