Hi simflex,
I have created sample code which full-fill your requirement. So please refer the below code.
HTML
<form id="form1" runat="server">
<asp:ScriptManager ID="scriptManager" runat="server">
</asp:ScriptManager>
<asp:MultiView ID="myMultiView" runat="server">
<asp:View ID="vwPersonalInfo" runat="server">
<div>
<table style="width: 100%; border: 1px solid black;">
<tr>
<td style="width: 33.3%; border-collapse: collapse; white-space: nowrap;">
<asp:Repeater ID="Repeater2" runat="server">
<HeaderTemplate>
<table id="repeaterTable" style="border: 1px solid black;">
</HeaderTemplate>
<ItemTemplate>
<table style="width: 100%; border: 1px solid black;">
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Registration "N" #:<asp:TextBox ID="aRegNo" Text="" Style="width: 270px; margin-left: 195px;"
runat="server"></asp:TextBox>
</td>
<td style="text-align: center; border: 1px solid black;">
AVIONICS AND EXTRA EQUIPMENT
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
MFG. Name: (make):<asp:TextBox ID="aMake" Style="width: 270px; margin-left: 175px;"
runat="server"></asp:TextBox>
</td>
<td style="width: 50%; text-align: center; border: 1px solid black;" rowspan="10">
<asp:TextBox ID="txtavionics" runat="server" TextMode="MultiLine" Style="width: 100%;
height: 700px;" class="form-control"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Model Name OR #::<asp:TextBox ID="aModelNo" Style="width: 270px; margin-left: 184px;"
runat="server"></asp:TextBox>
</td>
<td style="width: 50%; text-align: center; border: 0px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Year Built:<asp:TextBox ID="aYRBuilt" Style="width: 270px; margin-left: 252px;" runat="server"></asp:TextBox>
</td>
<td style="width: 50%; text-align: center; border: 0px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Serial Number:<asp:TextBox ID="aSN" Style="width: 270px; margin-left: 219px;" runat="server"></asp:TextBox>
</td>
<td style="width: 50%; text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Date Purchased:<asp:TextBox ID="txtdatePurchased" Style="width: 270px; margin-left: 205px;"
runat="server"></asp:TextBox>
</td>
<td style="width: 50%; text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black;">
Purchased:<asp:RadioButtonList ID="rblPurchaseType" runat="server" ValidationGroup="stype"
RepeatDirection="Horizontal" TextAlign="Right" Style="display: inline;">
<asp:ListItem Text="New" />
<asp:ListItem Text="Used" />
</asp:RadioButtonList>
<br />
<asp:RequiredFieldValidator Style="color: #ff0000;" ID="RequiredFieldValidator1"
ControlToValidate="rblPurchaseType" ErrorMessage="Please choose New or Used"
ValidationGroup="stype" runat="server" />
</td>
<td style="text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Cost:<asp:TextBox ID="aircraftCost" Style="width: 270px; margin-left: 287px;" runat="server"></asp:TextBox>
</td>
<td style="text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Hours Between Overhauls(TBO):<asp:TextBox ID="hrsBtwnTBO" Style="width: 270px; margin-left: 90px;"
runat="server"></asp:TextBox>
</td>
<td style="text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Hours Since Last OVerhaul:<asp:TextBox ID="hrsOverhaul" Style="width: 270px; margin-left: 127px;"
runat="server"></asp:TextBox>
</td>
<td style="text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Last Overhaul:<asp:RadioButtonList ID="rbllastOverHaul" ValidationGroup="stype" runat="server"
RepeatDirection="Horizontal" TextAlign="Right" Style="display: inline;">
<asp:ListItem Text="Major" />
<asp:ListItem Text="Top" />
</asp:RadioButtonList>
<br />
<asp:RequiredFieldValidator Style="color: #ff0000;" ID="RequiredFieldValidator2"
ControlToValidate="rbllastOverHaul" ErrorMessage="Please choose Major or Top"
ValidationGroup="stype" runat="server" />
</td>
<td style="text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Total Hours On Airframe As of Jan. 1:<asp:TextBox ID="TotOnAirFrm" Style="width: 270px;
margin-left: 58px;" runat="server"></asp:TextBox>
</td>
<td style="border: 1px solid black;">
NOTE: Please submit a copy of your log book to substantiate T.B.O. and<br />
airframe hours.
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="BtnAdd2" Style="width: 150px;" runat="server" Text="Add" OnClick="ButtonAdd2_Click"
CssClass="btnclass" />
<asp:Button ID="btnDelete" Style="width: 120px;" runat="server" Text="Delete"
CssClass="btnclass" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</table>
<asp:Button Text="Preview" OnClick="OnPreview" runat="server" />
</div>
</asp:View>
<asp:View ID="vwPreview" runat="server">
<table style="width: 100%; border: 1px solid black;">
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Registration "N" #:<asp:Label ID="lblARegNo" Text="" Style="width: 270px; margin-left: 195px;"
runat="server"></asp:Label>
</td>
<td style="text-align: center; border: 1px solid black;">
AVIONICS AND EXTRA EQUIPMENT
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
MFG. Name: (make):<asp:Label ID="lblAMake" Style="width: 270px; margin-left: 175px;"
runat="server"></asp:Label>
</td>
<td style="width: 50%; text-align: center; border: 1px solid black;" rowspan="10">
<asp:TextBox ID="txtavionics" runat="server" TextMode="MultiLine" Style="width: 100%;
height: 700px;" class="form-control"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Model Name OR #::<asp:Label ID="lblAModelNo" Style="width: 270px; margin-left: 184px;"
runat="server"></asp:Label>
</td>
<td style="width: 50%; text-align: center; border: 0px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Year Built:<asp:Label ID="lblAYRBuilt" Style="width: 270px; margin-left: 252px;"
runat="server"></asp:Label>
</td>
<td style="width: 50%; text-align: center; border: 0px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Serial Number:<asp:Label ID="lblASN" Style="width: 270px; margin-left: 219px;" runat="server"></asp:Label>
</td>
<td style="width: 50%; text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Date Purchased:<asp:Label ID="lblDatePurchased" Style="width: 270px; margin-left: 205px;"
runat="server"></asp:Label>
</td>
<td style="width: 50%; text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black;">
Purchased:<asp:Label ID="lblPurchType" Text="text" runat="server" />
<br />
</td>
<td style="text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Cost:<asp:Label ID="lblCost" Style="width: 270px; margin-left: 287px;" runat="server"></asp:Label>
</td>
<td style="text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Hours Between Overhauls(TBO):<asp:Label ID="lblTBO" Style="width: 270px; margin-left: 90px;"
runat="server"></asp:Label>
</td>
<td style="text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Hours Since Last OVerhaul:<asp:Label ID="OVerhaul" Style="width: 270px; margin-left: 127px;"
runat="server"></asp:Label>
</td>
<td style="text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Last Overhaul:<asp:Label ID="lblLastOverhaul" Text="text" runat="server" />
<br />
</td>
<td style="text-align: center; border: 1px solid black;">
</td>
</tr>
<tr>
<td style="width: 50%; border-collapse: collapse; border: 1px solid black; white-space: nowrap;">
Total Hours On Airframe As of Jan. 1:<asp:Label ID="lblTotOnAirFrm" Style="width: 270px;
margin-left: 58px;" runat="server"></asp:Label>
</td>
<td style="border: 1px solid black;">
NOTE: Please submit a copy of your log book to substantiate T.B.O. and<br />
airframe hours.
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="BtnAdd2" Style="width: 150px;" runat="server" Text="Back" OnClick="onclickBack"
CssClass="btnclass" />
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
</form>
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.SetInitialRow();
}
}
private void SetInitialRow()
{
myMultiView.ActiveViewIndex = 0;
DataTable dt = new DataTable();
DataRow dr = null;
//Create DataTable columns
dt.Columns.Add(new DataColumn("RowNumber", typeof(string)));
dt.Columns.Add(new DataColumn("aRegNo", typeof(string)));
dt.Columns.Add(new DataColumn("aMake", typeof(string)));
dt.Columns.Add(new DataColumn("txtavionics", typeof(string)));
dt.Columns.Add(new DataColumn("aModelNo", typeof(string)));
dt.Columns.Add(new DataColumn("aYRBuilt", typeof(string)));
dt.Columns.Add(new DataColumn("aSN", typeof(string)));
dt.Columns.Add(new DataColumn("txtdatePurchased", typeof(string)));
dt.Columns.Add(new DataColumn("rblPurchaseType", typeof(string)));
dt.Columns.Add(new DataColumn("aircraftCost", typeof(string)));
dt.Columns.Add(new DataColumn("hrsBtwnTBO", typeof(string)));
dt.Columns.Add(new DataColumn("hrsOverhaul", typeof(string)));
dt.Columns.Add(new DataColumn("rbllastOverHaul", typeof(string)));
dt.Columns.Add(new DataColumn("TotOnAirFrm", typeof(string)));
//Create Row for each columns
dr = dt.NewRow();
dr["RowNumber"] = 1;
dr["aRegNo"] = string.Empty;
dr["aMake"] = string.Empty;
dr["txtavionics"] = string.Empty;
dr["aModelNo"] = string.Empty;
dr["aYRBuilt"] = string.Empty;
dr["aSN"] = string.Empty;
dr["txtdatePurchased"] = string.Empty;
dr["rblPurchaseType"] = string.Empty;
dr["aircraftCost"] = string.Empty;
dr["hrsBtwnTBO"] = string.Empty;
dr["hrsOverhaul"] = string.Empty;
dr["rbllastOverHaul"] = string.Empty;
dr["TotOnAirFrm"] = string.Empty;
dt.Rows.Add(dr);
//Store the DataTable in ViewState for future reference
ViewState["CurrentTable1"] = dt;
//Bind the Repeater with the DataTable
Repeater2.DataSource = dt;
Repeater2.DataBind();
}
private void AddNewRow2()
{
int rowIndex = 0;
if (ViewState["CurrentTable1"] != null)
{
DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable1"];
DataRow drCurrentRow = null;
if (dtCurrentTable.Rows.Count > 0)
{
for (int i = 1; i <= dtCurrentTable.Rows.Count; i++)
{
TextBox txtaRegNo = (TextBox)Repeater2.Items[rowIndex].FindControl("aRegNo");
TextBox txtaMake = ((TextBox)Repeater2.Items[rowIndex].FindControl("aMake"));
TextBox txtaModelNo = ((TextBox)Repeater2.Items[rowIndex].FindControl("aModelNo"));
TextBox txtaYRBuilt = ((TextBox)Repeater2.Items[rowIndex].FindControl("aYRBuilt"));
TextBox txtaSN = ((TextBox)Repeater2.Items[rowIndex].FindControl("aSN"));
TextBox txtdatePurchased = ((TextBox)Repeater2.Items[rowIndex].FindControl("txtdatePurchased"));
RadioButtonList rbtlist1 = ((RadioButtonList)Repeater2.Items[rowIndex].FindControl("rblPurchaseType"));
TextBox txtaircraftCost = ((TextBox)Repeater2.Items[rowIndex].FindControl("aircraftCost"));
TextBox txthrsBtwnTBO = ((TextBox)Repeater2.Items[rowIndex].FindControl("hrsBtwnTBO"));
TextBox txthrsOverhaul = ((TextBox)Repeater2.Items[rowIndex].FindControl("hrsOverhaul"));
RadioButtonList rbtlist2 = ((RadioButtonList)Repeater2.Items[rowIndex].FindControl("rbllastOverHaul"));
TextBox txtTotOnAirFrm = ((TextBox)Repeater2.Items[rowIndex].FindControl("TotOnAirFrm"));
drCurrentRow = dtCurrentTable.NewRow();
drCurrentRow["RowNumber"] = i + 1;
dtCurrentTable.Rows[i - 1]["aRegNo"] = txtaRegNo.Text;
dtCurrentTable.Rows[i - 1]["aMake"] = txtaMake.Text;
dtCurrentTable.Rows[i - 1]["aModelNo"] = txtaModelNo.Text;
dtCurrentTable.Rows[i - 1]["aYRBuilt"] = txtaYRBuilt.Text;
dtCurrentTable.Rows[i - 1]["aSN"] = txtaSN.Text;
dtCurrentTable.Rows[i - 1]["txtdatePurchased"] = txtdatePurchased.Text;
dtCurrentTable.Rows[i - 1]["rblPurchaseType"] = rbtlist1.SelectedItem.Text;
dtCurrentTable.Rows[i - 1]["aircraftCost"] = txtaircraftCost.Text;
dtCurrentTable.Rows[i - 1]["hrsBtwnTBO"] = txthrsBtwnTBO.Text;
dtCurrentTable.Rows[i - 1]["hrsOverhaul"] = txthrsOverhaul.Text;
dtCurrentTable.Rows[i - 1]["rbllastOverHaul"] = rbtlist2.SelectedItem;
dtCurrentTable.Rows[i - 1]["TotOnAirFrm"] = txtTotOnAirFrm.Text;
rowIndex++;
}
dtCurrentTable.Rows.Add(drCurrentRow);
ViewState["CurrentTable1"] = dtCurrentTable;
Repeater2.DataSource = dtCurrentTable;
Repeater2.DataBind();
}
}
else
{
Response.Write("ViewState is null");
}
//Set Previous Data on Postbacks
SetPreviousData2();
}
private void SetPreviousData2()
{
int rowIndex = 0;
if (ViewState["CurrentTable1"] != null)
{
DataTable dt = (DataTable)ViewState["CurrentTable1"];
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
TextBox txtaRegNo = (TextBox)Repeater2.Items[rowIndex].FindControl("aRegNo");
TextBox txtaMake = ((TextBox)Repeater2.Items[rowIndex].FindControl("aMake"));
TextBox txtaModelNo = ((TextBox)Repeater2.Items[rowIndex].FindControl("aModelNo"));
TextBox txtaYRBuilt = ((TextBox)Repeater2.Items[rowIndex].FindControl("aYRBuilt"));
TextBox txtaSN = ((TextBox)Repeater2.Items[rowIndex].FindControl("aSN"));
TextBox txtdatePurchased = ((TextBox)Repeater2.Items[rowIndex].FindControl("txtdatePurchased"));
RadioButtonList rbtlist1 = ((RadioButtonList)Repeater2.Items[rowIndex].FindControl("rblPurchaseType"));
TextBox txtaircraftCost = ((TextBox)Repeater2.Items[rowIndex].FindControl("aircraftCost"));
TextBox txthrsBtwnTBO = ((TextBox)Repeater2.Items[rowIndex].FindControl("hrsBtwnTBO"));
TextBox txthrsOverhaul = ((TextBox)Repeater2.Items[rowIndex].FindControl("hrsOverhaul"));
RadioButtonList rbtlist2 = ((RadioButtonList)Repeater2.Items[rowIndex].FindControl("rbllastOverHaul"));
TextBox txtTotOnAirFrm = ((TextBox)Repeater2.Items[rowIndex].FindControl("TotOnAirFrm"));
txtaRegNo.Text = dt.Rows[i]["aRegNo"].ToString();
txtaMake.Text = dt.Rows[i]["aMake"].ToString();
txtaModelNo.Text = dt.Rows[i]["txtavionics"].ToString();
txtaYRBuilt.Text = dt.Rows[i]["aModelNo"].ToString();
txtaSN.Text = dt.Rows[i]["aYRBuilt"].ToString();
txtdatePurchased.Text = dt.Rows[i]["aSN"].ToString();
if (!string.IsNullOrEmpty(dt.Rows[i]["rblPurchaseType"].ToString()))
{
rbtlist1.Items.FindByText(dt.Rows[i]["rblPurchaseType"].ToString()).Selected = true;
}
txtaircraftCost.Text = dt.Rows[i]["aircraftCost"].ToString();
txthrsBtwnTBO.Text = dt.Rows[i]["hrsBtwnTBO"].ToString();
txthrsOverhaul.Text = dt.Rows[i]["hrsOverhaul"].ToString();
if (!string.IsNullOrEmpty(dt.Rows[i]["rbllastOverHaul"].ToString()))
{
rbtlist2.Items.FindByText(dt.Rows[i]["rbllastOverHaul"].ToString()).Selected = true;
}
txtTotOnAirFrm.Text = dt.Rows[i]["TotOnAirFrm"].ToString();
rowIndex++;
}
}
}
}
protected void ButtonAdd2_Click(object sender, EventArgs e)
{
AddNewRow2();
}
protected void OnPreview(object sender, EventArgs e)
{
myMultiView.ActiveViewIndex = 1;
FillSummary();
}
private void FillSummary()
{
int rowIndex = 0;
if (ViewState["CurrentTable1"] != null)
{
////Initialize datatable.
DataTable ctable = ViewState["CurrentTable1"] as DataTable;
////Lets start looping through the second datatable for aircraft schedule info.
if (ctable.Rows.Count > 0)
{
for (int i = 1; i <= Repeater2.Items.Count; i++)
{
lblARegNo.Text = ((TextBox)Repeater2.Items[rowIndex].FindControl("aRegNo")).Text;
lblAMake.Text = ((TextBox)Repeater2.Items[rowIndex].FindControl("aMake")).Text;
lblAModelNo.Text = ((TextBox)Repeater2.Items[rowIndex].FindControl("aModelNo")).Text;
lblAYRBuilt.Text = ((TextBox)Repeater2.Items[rowIndex].FindControl("aYRBuilt")).Text;
lblASN.Text = ((TextBox)Repeater2.Items[rowIndex].FindControl("aSN")).Text;
lblDatePurchased.Text = ((TextBox)Repeater2.Items[rowIndex].FindControl("txtdatePurchased")).Text;
lblPurchType.Text = ((RadioButtonList)Repeater2.Items[rowIndex].FindControl("rblPurchaseType")).SelectedItem.Text;
lblCost.Text = ((TextBox)Repeater2.Items[rowIndex].FindControl("aircraftCost")).Text;
lblTBO.Text = ((TextBox)Repeater2.Items[rowIndex].FindControl("hrsBtwnTBO")).Text;
OVerhaul.Text = ((TextBox)Repeater2.Items[rowIndex].FindControl("hrsOverhaul")).Text;
lblLastOverhaul.Text = ((RadioButtonList)Repeater2.Items[rowIndex].FindControl("rbllastOverHaul")).SelectedItem.Text;
lblTotOnAirFrm.Text = ((TextBox)Repeater2.Items[rowIndex].FindControl("TotOnAirFrm")).Text;
}
}
}
}
protected void onclickBack(object sender, EventArgs e)
{
myMultiView.ActiveViewIndex = 0;
}
Vb.Net
Protected Sub Page_Load(sender As Object, e As EventArgs)Handles Me.Load
If Not IsPostBack Then
Me.SetInitialRow()
End If
End Sub
Private Sub SetInitialRow()
myMultiView.ActiveViewIndex = 0
Dim dt As New DataTable()
Dim dr As DataRow = Nothing
'Create DataTable columns
dt.Columns.Add(New DataColumn("RowNumber", GetType(String)))
dt.Columns.Add(New DataColumn("aRegNo", GetType(String)))
dt.Columns.Add(New DataColumn("aMake", GetType(String)))
dt.Columns.Add(New DataColumn("txtavionics", GetType(String)))
dt.Columns.Add(New DataColumn("aModelNo", GetType(String)))
dt.Columns.Add(New DataColumn("aYRBuilt", GetType(String)))
dt.Columns.Add(New DataColumn("aSN", GetType(String)))
dt.Columns.Add(New DataColumn("txtdatePurchased", GetType(String)))
dt.Columns.Add(New DataColumn("rblPurchaseType", GetType(String)))
dt.Columns.Add(New DataColumn("aircraftCost", GetType(String)))
dt.Columns.Add(New DataColumn("hrsBtwnTBO", GetType(String)))
dt.Columns.Add(New DataColumn("hrsOverhaul", GetType(String)))
dt.Columns.Add(New DataColumn("rbllastOverHaul", GetType(String)))
dt.Columns.Add(New DataColumn("TotOnAirFrm", GetType(String)))
'Create Row for each columns
dr = dt.NewRow()
dr("RowNumber") = 1
dr("aRegNo") = String.Empty
dr("aMake") = String.Empty
dr("txtavionics") = String.Empty
dr("aModelNo") = String.Empty
dr("aYRBuilt") = String.Empty
dr("aSN") = String.Empty
dr("txtdatePurchased") = String.Empty
dr("rblPurchaseType") = String.Empty
dr("aircraftCost") = String.Empty
dr("hrsBtwnTBO") = String.Empty
dr("hrsOverhaul") = String.Empty
dr("rbllastOverHaul") = String.Empty
dr("TotOnAirFrm") = String.Empty
dt.Rows.Add(dr)
'Store the DataTable in ViewState for future reference
ViewState("CurrentTable1") = dt
'Bind the Repeater with the DataTable
Repeater2.DataSource = dt
Repeater2.DataBind()
End Sub
Private Sub AddNewRow2()
Dim rowIndex As Integer = 0
If ViewState("CurrentTable1") IsNot Nothing Then
Dim dtCurrentTable As DataTable = DirectCast(ViewState("CurrentTable1"), DataTable)
Dim drCurrentRow As DataRow = Nothing
If dtCurrentTable.Rows.Count > 0 Then
For i As Integer = 1 To dtCurrentTable.Rows.Count
Dim txtaRegNo As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aRegNo"), TextBox)
Dim txtaMake As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aMake"), TextBox)
Dim txtaModelNo As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aModelNo"), TextBox)
Dim txtaYRBuilt As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aYRBuilt"), TextBox)
Dim txtaSN As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aSN"), TextBox)
Dim txtdatePurchased As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("txtdatePurchased"), TextBox)
Dim rbtlist1 As RadioButtonList = DirectCast(Repeater2.Items(rowIndex).FindControl("rblPurchaseType"), RadioButtonList)
Dim txtaircraftCost As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aircraftCost"), TextBox)
Dim txthrsBtwnTBO As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("hrsBtwnTBO"), TextBox)
Dim txthrsOverhaul As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("hrsOverhaul"), TextBox)
Dim rbtlist2 As RadioButtonList = DirectCast(Repeater2.Items(rowIndex).FindControl("rbllastOverHaul"), RadioButtonList)
Dim txtTotOnAirFrm As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("TotOnAirFrm"), TextBox)
drCurrentRow = dtCurrentTable.NewRow()
drCurrentRow("RowNumber") = i + 1
dtCurrentTable.Rows(i - 1)("aRegNo") = txtaRegNo.Text
dtCurrentTable.Rows(i - 1)("aMake") = txtaMake.Text
dtCurrentTable.Rows(i - 1)("aModelNo") = txtaModelNo.Text
dtCurrentTable.Rows(i - 1)("aYRBuilt") = txtaYRBuilt.Text
dtCurrentTable.Rows(i - 1)("aSN") = txtaSN.Text
dtCurrentTable.Rows(i - 1)("txtdatePurchased") = txtdatePurchased.Text
dtCurrentTable.Rows(i - 1)("rblPurchaseType") = rbtlist1.SelectedItem.Text
dtCurrentTable.Rows(i - 1)("aircraftCost") = txtaircraftCost.Text
dtCurrentTable.Rows(i - 1)("hrsBtwnTBO") = txthrsBtwnTBO.Text
dtCurrentTable.Rows(i - 1)("hrsOverhaul") = txthrsOverhaul.Text
dtCurrentTable.Rows(i - 1)("rbllastOverHaul") = rbtlist2.SelectedItem
dtCurrentTable.Rows(i - 1)("TotOnAirFrm") = txtTotOnAirFrm.Text
rowIndex += 1
Next
dtCurrentTable.Rows.Add(drCurrentRow)
ViewState("CurrentTable1") = dtCurrentTable
Repeater2.DataSource = dtCurrentTable
Repeater2.DataBind()
End If
Else
Response.Write("ViewState is null")
End If
'Set Previous Data on Postbacks
SetPreviousData2()
End Sub
Private Sub SetPreviousData2()
Dim rowIndex As Integer = 0
If ViewState("CurrentTable1") IsNot Nothing Then
Dim dt As DataTable = DirectCast(ViewState("CurrentTable1"), DataTable)
If dt.Rows.Count > 0 Then
For i As Integer = 0 To dt.Rows.Count - 1
Dim txtaRegNo As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aRegNo"), TextBox)
Dim txtaMake As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aMake"), TextBox)
Dim txtaModelNo As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aModelNo"), TextBox)
Dim txtaYRBuilt As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aYRBuilt"), TextBox)
Dim txtaSN As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aSN"), TextBox)
Dim txtdatePurchased As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("txtdatePurchased"), TextBox)
Dim rbtlist1 As RadioButtonList = DirectCast(Repeater2.Items(rowIndex).FindControl("rblPurchaseType"), RadioButtonList)
Dim txtaircraftCost As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("aircraftCost"), TextBox)
Dim txthrsBtwnTBO As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("hrsBtwnTBO"), TextBox)
Dim txthrsOverhaul As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("hrsOverhaul"), TextBox)
Dim rbtlist2 As RadioButtonList = DirectCast(Repeater2.Items(rowIndex).FindControl("rbllastOverHaul"), RadioButtonList)
Dim txtTotOnAirFrm As TextBox = DirectCast(Repeater2.Items(rowIndex).FindControl("TotOnAirFrm"), TextBox)
txtaRegNo.Text = dt.Rows(i)("aRegNo").ToString()
txtaMake.Text = dt.Rows(i)("aMake").ToString()
txtaModelNo.Text = dt.Rows(i)("txtavionics").ToString()
txtaYRBuilt.Text = dt.Rows(i)("aModelNo").ToString()
txtaSN.Text = dt.Rows(i)("aYRBuilt").ToString()
txtdatePurchased.Text = dt.Rows(i)("aSN").ToString()
If Not String.IsNullOrEmpty(dt.Rows(i)("rblPurchaseType").ToString()) Then
rbtlist1.Items.FindByText(dt.Rows(i)("rblPurchaseType").ToString()).Selected = True
End If
txtaircraftCost.Text = dt.Rows(i)("aircraftCost").ToString()
txthrsBtwnTBO.Text = dt.Rows(i)("hrsBtwnTBO").ToString()
txthrsOverhaul.Text = dt.Rows(i)("hrsOverhaul").ToString()
If Not String.IsNullOrEmpty(dt.Rows(i)("rbllastOverHaul").ToString()) Then
rbtlist2.Items.FindByText(dt.Rows(i)("rbllastOverHaul").ToString()).Selected = True
End If
txtTotOnAirFrm.Text = dt.Rows(i)("TotOnAirFrm").ToString()
rowIndex += 1
Next
End If
End If
End Sub
Protected Sub ButtonAdd2_Click(sender As Object, e As EventArgs)
AddNewRow2()
End Sub
Protected Sub OnPreview(sender As Object, e As EventArgs)
myMultiView.ActiveViewIndex = 1
FillSummary()
End Sub
Private Sub FillSummary()
Dim rowIndex As Integer = 0
If ViewState("CurrentTable1") IsNot Nothing Then
'''/Initialize datatable.
Dim ctable As DataTable = TryCast(ViewState("CurrentTable1"), DataTable)
'''/Lets start looping through the second datatable for aircraft schedule info.
If ctable.Rows.Count > 0 Then
For i As Integer = 1 To Repeater2.Items.Count
lblARegNo.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("aRegNo"), TextBox).Text
lblAMake.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("aMake"), TextBox).Text
lblAModelNo.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("aModelNo"), TextBox).Text
lblAYRBuilt.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("aYRBuilt"), TextBox).Text
lblASN.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("aSN"), TextBox).Text
lblDatePurchased.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("txtdatePurchased"), TextBox).Text
lblPurchType.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("rblPurchaseType"), RadioButtonList).SelectedItem.Text
lblCost.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("aircraftCost"), TextBox).Text
lblTBO.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("hrsBtwnTBO"), TextBox).Text
OVerhaul.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("hrsOverhaul"), TextBox).Text
lblLastOverhaul.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("rbllastOverHaul"), RadioButtonList).SelectedItem.Text
lblTotOnAirFrm.Text = DirectCast(Repeater2.Items(rowIndex).FindControl("TotOnAirFrm"), TextBox).Text
Next
End If
End If
End Sub
Protected Sub onclickBack(sender As Object, e As EventArgs)
myMultiView.ActiveViewIndex = 0
End Sub