1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
[Category("Configuration")]
public String recordId { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
PopulateGridview();
}
private void PopulateGridview()
{
this.GridView_Cashflow.DataSource = CashflowRow.getCashflowRowbyRecordId(recordId);
this.GridView_Cashflow.DataBind();
}
protected void rowEditing_Click(object sender, GridViewEditEventArgs e)
{
GridView_Cashflow.EditIndex = e.NewEditIndex;
PopulateGridview();
}
protected void rowCancelingEdit_Click(object sender, GridViewCancelEditEventArgs e)
{
GridView_Cashflow.EditIndex = -1;
PopulateGridview();
}
protected void rowUpdating_Click(object sender, GridViewUpdateEventArgs e)
{
tbl_dealmaker_CashflowRow _cshf = new tbl_dealmaker_CashflowRow();
_cshf.CashflowRowID = (int)GridView_Cashflow.DataKeys[e.RowIndex].Value;
_cshf.Year1 = Convert.ToInt32(((GridView_Cashflow.Rows[e.RowIndex].FindControl("txt_year1") as TextBox).Text));
_cshf.Year2 = Convert.ToInt32(((GridView_Cashflow.Rows[e.RowIndex].FindControl("txt_year2") as TextBox).Text));
_cshf.Year3 = Convert.ToInt32(((GridView_Cashflow.Rows[e.RowIndex].FindControl("txt_year3") as TextBox).Text));
_cshf.Year4 = Convert.ToInt32(((GridView_Cashflow.Rows[e.RowIndex].FindControl("txt_year4") as TextBox).Text));
_cshf.Year5 = Convert.ToInt32(((GridView_Cashflow.Rows[e.RowIndex].FindControl("txt_year5") as TextBox).Text));
_cshf.Year6 = Convert.ToInt32(((GridView_Cashflow.Rows[e.RowIndex].FindControl("txt_year6") as TextBox).Text));
_cshf.Year7 = Convert.ToInt32(((GridView_Cashflow.Rows[e.RowIndex].FindControl("txt_year7") as TextBox).Text));
CashflowRow.updateCashflowByCashflowRowId(_cshf);
GridView_Cashflow.EditIndex = -1;
PopulateGridview();
} |
Partager