当我在表格中单击选定的行值时,打开具有绑定值的部分视图 [英] When i am clicking selected row values in table at a time open partial view with binded that values
问题描述
i我正在使用mvc4 web应用程序。在我的项目中,我有两个parial views.one用于列出deatils,另一个用于更新details.Now我想要点击listng查看时间打开了另一个部分的选定值。
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>
我的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'));
});
功能票证(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,
类型:'post',
数据:ko.toJSON(this),
contentType:'application / json',
成功:功能(结果){}
});
}
}
函数TicketList(){
var self = this;
self .sample = ko.observableArray([]);
$ .getJSON(/ api / helpdeskapi,function(data){
$ .each(data,functio) n(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;
};
}
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;
};
}
推荐答案
(document).ready(function(){
ko.applyBindings(new TicketList(),document.getElementById('displaynode'));
ko.applyBindings(new Ticket(),document.getElementById('AddNewTicketpopup'));
ko.applyBindings(new TicketList(),document.getElementById('ViewTicketpopup'));
});
功能票证(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(){
(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,
类型:'post',
数据:ko.toJSON(this),
contentType:'application / json',
成功:函数(结果){}
});
}
}
fun提示TicketList(){
var self = this;
self.sample = ko.observableArray([]);
.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){
.getJSON("/api/helpdeskapi", function (data) {
这篇关于当我在表格中单击选定的行值时,打开具有绑定值的部分视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!