开发者_运维百科It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
开发者_运维百科 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
This is the scenario:
I have a web page with a ListView lv_create_claim which contains a nested ListView lv_fees which contain textboxes.
On update_button click I need to validate all values in textboxes on database. Procedure will return status and validation errors. If there are any errors I need to repopulate lv_fees textboxes with entered values. So I need to keep all entered data in session. To accomplish this I update session DataTable iterating through all textboxes in all nested lv_fees.
Here is the question. Is there any better and more efficient way to update session DataTable with values I get from ListView.
DataTable dt = HttpContext.Current.Session[ "PopulationData" ] as DataTable;
int i = 0;
foreach( ListViewItem item in lv_create_claim.Items )
{
ListView fees = item.FindControl( "lv_fees" ) as ListView;
DataRow row;
foreach( ListViewDataItem x in fees.Items )
{
row = dt.Rows[ i ];
row.BeginEdit();
row[ "claim_amt" ] = PFFormat.GetCurrency(( x.FindControl( "txb_cliam" ) as TextBox ).Text);
row[ "start_date" ] = ( x.FindControl( "txb_from_date" ) as TextBox ).Text;
row[ "end_date" ] = ( x.FindControl( "txb_from_date" ) as TextBox ).Text;
row.EndEdit();
i++;
}
}
精彩评论