This is a migrated thread and some comments may be shown as answers.

Scheduler addEvent hidden field value not populated

4 Answers 79 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Anamika
Top achievements
Rank 1
Anamika asked on 27 Nov 2014, 07:30 AM
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

4 Answers, 1 is accepted

Sort by
0
Anamika
Top achievements
Rank 1
answered on 27 Nov 2014, 10:06 AM
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
0
Georgi Krustev
Telerik team
answered on 01 Dec 2014, 08:06 AM
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.

 
0
Anamika
Top achievements
Rank 1
answered on 01 Dec 2014, 08:18 AM
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
0
Georgi Krustev
Telerik team
answered on 01 Dec 2014, 12:34 PM
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.

 
Tags
Scheduler
Asked by
Anamika
Top achievements
Rank 1
Answers by
Anamika
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or