0
我在Company
類中有List<BankAccount> Company_Accounts
屬性。 對CreateCompany
頁面一個或多個BankAccount
信息正在動態輸入表格中。我想要javascript/jquery代碼迭代每一行並創建一個新的Account
類型對象,並在Company_Accounts
中創建此推送對象。在列表類型對象中迭代表和設置值
我在Company
類中有List<BankAccount> Company_Accounts
屬性。 對CreateCompany
頁面一個或多個BankAccount
信息正在動態輸入表格中。我想要javascript/jquery代碼迭代每一行並創建一個新的Account
類型對象,並在Company_Accounts
中創建此推送對象。在列表類型對象中迭代表和設置值
// 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
});
在不知道對象原型的情況下無法幫助您,並且每次修改表時都想刷新數組。
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