Dropdownlist readonly() not recognized

5 posts, 1 answers
  1. Tim
    Tim avatar
    5 posts
    Member since:
    Sep 2011

    Posted 15 Apr 2013 Link to this post


    I am evaluating the kendo controls for purchase and I am having trouble setting a kendo dropdown to readonly in mvc 4 using the razor view engine. I keep getting the error

    0x800a01b6 - Microsoft JScript runtime error: Object doesn't support property or method 'readonly'

    My solution is a little more complex but basically I have the below code with a bunch of stuff cut out. Everything works fine until i want to set the dropdown to read only on page load in one of my cases. It seems like I am following the documentation but i can't see to figure out what is wrong.  I've spent a good few hours on this and am out of tricks. I've got access to the dropdown for click events that i set on buttons and such but not during the $(document).ready.

    I feel like something in .readonly() is using something not in my jquery but that is only a wild guess.

    Thanks in a advance

    //.readonly()doesn't work
      $(document).ready(function () {
            var something = $("#ProvinceRegion").data("kendoDropDownList");

    //note: something.enable(false); works here just readonly() doesn't


    //notice I can set .enabled on this function below
        function ClearCustomerClick() {

    //all the below work
            var dropdownlist = $("#CustomerName").data("kendoDropDownList")
            var billContactList = $("#BillingContact").data("kendoDropDownList")
            var billSiteList = $("#BillSite").data("kendoDropDownList")



    and then my dropdown list is below

    @using (Html.BeginForm("ProjectSetupDetails", "Setup", FormMethod.Post, new { enctype = "multipart/form-data" }))
                            .OptionLabel("Pick a region...")

  2. Answer
    Georgi Krustev
    Georgi Krustev avatar
    3688 posts

    Posted 16 Apr 2013 Link to this post

    Hello Tim,

    The readonly functionality is available since Q1 2013 (2013.1.319). Before this release the widgets did not have support for readonly. Please verify that you are using the latest official release of Kendo UI.
    Check this jsBin demo, which shows how to use readonly method.

    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET AJAX banner
  4. Tim
    Tim avatar
    5 posts
    Member since:
    Sep 2011

    Posted 18 Apr 2013 Link to this post

    Thanks for your reply.

    I am currently using the 2012.3.1114.340 for Kendo.MVC dll. I will look into updating the to the latest version to see if I can get readonly to work.

    **Update: Georgi's solution worked
  5. Development Team
    Development Team avatar
    2 posts
    Member since:
    Oct 2008

    Posted 30 Aug Link to this post

    Is there any way to set a kendo dropdown to readonly when using the mvc razor html helpers to generate the control?

    All the threads I have found only show examples doing it with the javascript function, but surely there must be a way to do this with razor in c#.


  6. Eyup
    Eyup avatar
    2941 posts

    Posted 01 Sep Link to this post


    You can use the following approach to achieve this requirement:
    .HtmlAttributes(new { style = "width:50%", @readonly = "readonly" })

    I hope this will prove helpful.

    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET AJAX banner