たとえば、私が事業体->顧客を持っている場合、とを持っているとしcustomerId
ましょcustomerName
うcustomerType
。runat = "server"にasp:HiddenVariablehdnCustomerを作成しました
顧客のビジネスエンティティの値(コードビハインド)をhdnCustomerにシリアル化する場合、どのようにすればよいですか?また、シリアル化されたら、どのように逆シリアル化できますか?
// Pseudo code
Collection<Customer> customerList = new Collection<Customer>();
customerList = BusinessAccess.GetCustomerList();
hdnCustomer = serialize and assign the value of 'customerList' to hdnCustomer;
...
...
// Later on a select index change of one of the drop down lists
ドロップダウンリストのイベントハンドラー内:
{
Collection<Customer> customerList = new Collection<Customer>();
customerList = deserialize the value from hdnCustomer
int a = Convert.ToInt32(ddlDropDown.SelectedValue);
foreach(a in customerList)
{
// Do something
}
}