0

List<BankAccount> Company_Accounts在课堂上有一处房产Company。在CreateCompany页面上 一个或多个BankAccount信息被动态输入到表格中。我希望 javascript/jquery 代码迭代每一行并创建一个新的Account类型对象,并在Company_Accounts.

4

2 回答 2

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
于 2013-06-21T11:38:34.400 回答
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
});

在不知道对象原型的情况下,如果您想在每次修改表时刷新数组,都无法为您提供更多帮助。

于 2013-06-20T10:01:25.427 回答