Telerik Forums
UI for ASP.NET MVC Forum
1 answer
126 views
I noticed when you change the parent combobox value, that will reload the child dropdown, and if the previous child text is not in the new dropdown then the value to be set to an empty string.  Is it possible to reload the option list, but keep the old value of the child combobox unless the user picks or enters a new value?

Thanks.
Georgi Krustev
Telerik team
 answered on 03 Dec 2014
0 answers
104 views
(TELERIK MVC Grid)
  When you click the sort,firefox has a question。
  in firebug ,Browser execute  one post request, but background request execution twice。
  One Query all( data and record --all ), One Query filter( data and record  --filter)

  Chrome and IE no problem
  One Query filter( data and record  --filter)
 
  'telerik.ui.for.aspnetmvc.2014.2.716.trial' and 'telerik.ui.for.aspnetmvc.2014.3.1119.trial' have the same problem
   this is really a big problem
Ying
Top achievements
Rank 1
 asked on 02 Dec 2014
2 answers
998 views
Hi,

I'm struggling to get the client template working with any number format other than 'n' or 'c2' for a bound column.

The following doesn't work and gives a javascript error -> Uncaught Error: Invalid template

boundcol.ClientTemplate("#= data.C0 !== null ? kendo.toString(data.C0,'##,#') : ''#");

Any ideas?

Steven.
Steven
Top achievements
Rank 1
Iron
 answered on 02 Dec 2014
1 answer
201 views
Hi,

I have two listviews that are linked together as linked list sortables. The drag and drop functionality is working really well but I need to be able to limit the number of items in the second listview so that when a user tries to drag an item into the second listview it cancels the move event and displays a message. I can't find an example of this anywhere.

Thanks in advance,
Luke
Alexander Valchev
Telerik team
 answered on 02 Dec 2014
4 answers
197 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
182 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
215 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
408 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
166 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
300 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
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
MediaPlayer
TileLayout
DateInput
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
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Jesse
Top achievements
Rank 2
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?