Telerik Forums
UI for ASP.NET MVC Forum
6 answers
112 views
Hi, i try several thing to make my listview working without success. I do not see any error in console, but the initial "get" request not fired. I can't see where a make a mistake..

My js definition:
<script src="~/LibsExt/jquery-1.11.0.min.js"></script>
<script src="~/LibsExt/bootstrap.min.js"></script>
<script src="~/LibsExt/kendo.web.min.js"></script>
<script src="~/LibsExt/kendo.aspnetmvc.min.js"></script>

My Controler (in the action function I do nothing for now. I just when to test if my breakpoint will be hit.
public ActionResult Produits_Read([DataSourceRequest] DataSourceRequest request)
{
    int i = 0;
    return Json("");
}

my model
public class ProduitModel
{
    public int id { get; set; }
    public string Nom { get; set; }
    public string urlThumb { get; set; }
    public string urlImage { get; set; }
    public string descCourte { get; set; }
    public IHtmlString contenu { get; set; }
    public decimal prix { get; set; }
}

Then my view
@(Html.Kendo().ListView<ProduitModel>(@Model.produits)
    .Name("listView")
    .TagName("div")
    .ClientTemplateId("produitTemp")
    .DataSource(dataSource => {
        dataSource.Read(read => read.Action("Produits_Read","CategoriesController").Type(HttpVerbs.Get));
        dataSource.PageSize(15);
    })
    .Pageable()
    .BindTo((IEnumerable<ProduitModel>)ViewData["listView"])
)

I try with or without the .BindTo command with same result.
What are missing?
I am running in umbraco7 MVC 4 environnement. meaby is the point? Need to add something there in routing or config?
Thanks a lot
Kiril Nikolov
Telerik team
 answered on 03 Dec 2014
1 answer
104 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
87 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
947 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
177 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
182 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
164 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
199 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
359 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
147 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?