This question is locked. New answers and comments are not allowed.
Hi Telerik team,
I have a model window in my partial view, I make an ajax call to update some values and read the same again in model window.
my problem is after the window is opened , the new value does not appear.
i have debug using break points and see that the partial view having model window form fields are created with new value, but during rendering still do not get updated form values.
attached is the code. Also i tried using the cache: flase to make sure it is refreshed but does not help.. I have tried multiple things to make sure it works but in vain
The Window is involed after ajax call using below script
Also below is the code from controller that refreshes partial view.
I have a model window in my partial view, I make an ajax call to update some values and read the same again in model window.
my problem is after the window is opened , the new value does not appear.
i have debug using break points and see that the partial view having model window form fields are created with new value, but during rendering still do not get updated form values.
attached is the code. Also i tried using the cache: flase to make sure it is refreshed but does not help.. I have tried multiple things to make sure it works but in vain
@(Html.Telerik().Window() .Name("EditContactWindow") .Title("Edit Contact") .Content(@<text> @{ Html.EnableClientValidation(); Html.ValidationSummary(true); } <script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/MicrosoftMvcAjax.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/MicrosoftMvcValidation.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script><script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script> @using (Html.BeginForm("GetProfile", "PeopleManagement", FormMethod.Post, new { id = "EditContactForm" })) { <p class="note"> Please Enter the contact details below</p> <table border="0" cellpadding="0" cellspacing="0" id="EditContactsTable"> @{ string toCheck = ViewBag.ContactIDToEdit; int count = (from n in Model.PartnerDetails.Contacts where n.PrimaryContactId==toCheck select n).Count(); //Model.PartnerDetails.Contacts.Count(listItem => (listItem.PrimaryContactId.Equals(toCheck))); } <tr> <td class="table_label_cell" width="20%" > <font color="red">*</font><label for="firstname">@ViewResources.PartnerManagement.GetPartnerProfile.FirstName :</label> </td> <td class="table_value_cell" width="40%"> @Html.TextBoxFor(m => m.PartnerDetails.Contacts[count].PrimaryContacts.FirstName) </td> <td class="table_value_cell" width="40%"> @Html.ValidationMessageFor(e => e.PartnerDetails.Contacts[count].PrimaryContacts.FirstName) </td> </tr> <tr> <td class="table_label_cell" width="20%"> <font color="red">*</font><label for="lastname">@ViewResources.PartnerManagement.GetPartnerProfile.LastName :</label> </td> <td class="table_value_cell" width="40%"> @Html.TextBoxFor(m => m.PartnerDetails.Contacts[count].PrimaryContacts.LastName) </td> <td class="table_value_cell" width="40%"> @Html.ValidationMessageFor(e => e.PartnerDetails.Contacts[count].PrimaryContacts.LastName) </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td align="center" colspan="3"> <button type="submit" class="t-button t-state-default" style="width: 100px">@Save</button> <input type="reset" title="Close" value="Close" class="t-button t-state-default" style="width: 100px" onclick="closeNewContactWindow()" /> </td> </tr> </table> <br /> } </text>) .Width(700) .Height(320) .Draggable(true) .Modal(true) .Visible(false) .ClientEvents(t => t.OnLoad("ModelWindow_onLoad"))The Window is involed after ajax call using below script
function setHiddenFieldValue(buttonEditClicked) { $('#contactIdHiddenFld').val(""); $('#contactIdHiddenFld').val(buttonEditClicked.title) ; alert($('#contactIdHiddenFld').val()); $.ajax({ url: "@Url.Action("SetProfileContactID", "PeopleManagement")", data: {partnerContactID: $("#contactIdHiddenFld").val()}, dataType: 'html', type: "POST", error: function() { alert("An error occurred."); }, success: function(data) { var windowElement = $('#EditContactWindow'); windowElement.data('tWindow').center().open(); } }); }Also below is the code from controller that refreshes partial view.
[HttpPost] public ActionResult SetProfileContactID(string partnerContactID) { ViewBag.ContactIDToEdit = partnerContactID; //Forming the partner details model for GetPartnerProfile view DetailsModel Details = new Details();// logic to fill up this DetailsViewModel DetailsViewModel = new DetailsViewModel(); DetailsViewModel.Details = Details; return PartialView("GetContactsPartial", DetailsViewModel); }