我在课程List<BankAccount> Company_Accounts
中有一个Company
属性。
在CreateCompany
页面上动态输入一个或多个BankAccount
个信息。我希望javascript / jquery代码迭代每一行,并在Account
中创建一个新的Company_Accounts
类型对象和这个推送对象。
答案 0 :(得分:0)
// create your empty array, or get a previous array
$(#tableid tr).each(function(index, element) {
// we are itering through every row of the table. Index is the number of the line (from 0), and element the line
// here some treatment to read the columns and create a new AccountType
// Check if same object already exist in table (maybe), if not push it back to the array
});
在不知道对象原型的情况下无法帮助您,并且每次修改表时是否想要刷新数组。
答案 1 :(得分:0)
class Company{
string Name{get; set;}
string address{get;set;}
IList<BankAccount> Accounts{get; set;}
}
class BankAccount{
Company CompanyName{get; set;}
string BankName{get; set;}
string AccountNo{get; set;}
string BankAddress{get; set;}
}
On create page for company i create and delete dynamically new BankAccount information by taking entry in Table's <td> cell having inputbox.
I have to bind the List of newly created BankAccount to the CompanyModel on view page