Hi,
i am using mvc4 web application.In My project i have two parial views.one is for listing deatils and another one is for updating details.Now i want when i am clicking the listng view that time opened another partial with selected values.
<tbody>
<tr>
<td width="100%" align="left" valign="top"><label>Summary:</label></td>
</tr>
<tr>
<td align="left" valign="top"><input type="text" data-bind="value:JobId" required /></td>
</tr>
<tr>
<td align="left" valign="top"><label>Description:</label></td>
</tr>
<tr>
<td align="left" valign="top"><textarea name="message" cols="40" rows="6" data-bind="text:JobDesc" required ></textarea></td>
</tr>
My KnockoutJs:
// <reference path="../Scripts/jquery-1.7.1.min.js">
//<reference path="../Scripts/knockout-2.3.0.js">
$(document).ready(function () {
ko.applyBindings(new TicketList(), document.getElementById('displaynode'));
ko.applyBindings(new Ticket(), document.getElementById('AddNewTicketpopup'));
ko.applyBindings(new TicketList(), document.getElementById('ViewTicketpopup'));
});
function Ticket(JobID, JobTitle, JobDesc, CategoryId, CreatedDateTime, JobContactPerson,JobContactPhone, JobPriority, JobStatus, ClientId) {
var self = this;
self.JobID = JobID;
self.CategoryId = CategoryId;
self.CreatedDateTime = CreatedDateTime;
self.JobTitle = JobTitle;
self.JobStatus = JobStatus;
self.JobPriority = JobPriority;
self.ClientId = ClientId;
self.JobDesc = JobDesc;
self.JobContactPerson = JobContactPerson;
self.JobContactPhone = JobContactPhone;
self.addTicket = function () {
$.ajax({
url: "api/helpdeskapi",
type: 'post',
data: ko.toJSON(this),
contentType: 'application/json',
success: function (result) { }
});
}
}
function TicketList() {
var self = this;
self.sample = ko.observableArray([]);
$.getJSON("/api/helpdeskapi", function (data) {
$.each(data, function (key, val) {
self.sample.push(new Ticket(val.JobId, val.JobTitle, val.JobDesc, val.CategoryId, val.CreatedDateTime, val.JobContactPerson, val.JobContactPhone, val.JobPriorityId, val.JobStatusId, val.ClientId));
});
});
self.AddJob = function (Job) {
self.JobTitle = Job.JobTitle;
self.JobId = Job.JobID;
self.JobDesc = Job.JobDesc;
};
}