Click here to Skip to main content
15,878,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
XML
<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;

};
}
Posted
Updated 6-Aug-13 18:04pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900