Scheduler addEvent hidden field value not populated

5 posts, 0 answers
  1. Anamika
    Anamika avatar
    124 posts
    Member since:
    Mar 2014

    Posted 27 Nov 2014 Link to this post

    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
  2. Anamika
    Anamika avatar
    124 posts
    Member since:
    Mar 2014

    Posted 27 Nov 2014 in reply to Anamika Link to this post

    Ok just another finding it might not have anything to do with hidden field as if i show the objectID textbox still i do not see it populated. In my viewmodel i have objectID required and the moment add window pops up i get message objectID required.
     [Required]
            [DisplayName("Objekt")]
            public string ObjectID { get; set; }
    If i take out required from viewmodel then ObjectID is populated even as hidden field. Not sure if kendo validator is playing some role in overwriting the value if field is required. Can you think of a fix with this field required and prepopulated

    Anamika
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 01 Dec 2014 Link to this post

    Hello Anamika,

    I tried to replicate the issue locally, but to no avail (here is a screencast of my tests). Could you send us a simple repro demo that shows the issue? Thus we will be able to review the problem locally and advice you further.

    Regards,
    Georgi Krustev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Anamika
    Anamika avatar
    124 posts
    Member since:
    Mar 2014

    Posted 01 Dec 2014 in reply to Georgi Krustev Link to this post

    Hello,

    As i mentioned it happens when in viewmodel class i have required mentioned.
      [Required]
            [DisplayName("Objekt")]
            public string ObjectID { get; set; }

    If i remove required then the hidden field has value. But i will need required.

    Thanks

    Anamika
  6. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 01 Dec 2014 Link to this post

    Hello Anamika,

    I believe the problem is not related. Here is another screencast, that I took with correctly decorated property, but it still works as expected. I would ask you to send us a repro demo in order to assist you further.

    Regards,
    Georgi Krustev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready