M
Morris Neuman
4/21/09 - sent to MSGroup - Wizard Control - #2
Hi,
I have a Wizard with several steps.
In Step 2 I have a FormView whose InsertItemTemplate contains a table that
has labels and textboxes that the user can update.
<asp:FormView ID="FormView1" runat="server"
OnPreRender="FV1_PreRender"
DefaultMode="Insert">
<InsertItemTemplate>
<span style="font-family: Verdana; font-size: 10pt;
color: navy;">
<table cellpadding="5" cellspacing="0" frame="border">
<tr>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:Label ID="Label15" runat="server"
style="font-size: 8pt" Text="Status:"></asp:Label>
</span>
</td>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:TextBox ID="TBStatus"
runat="server" Width="27px" Wrap="False"></asp:TextBox>
</span>
</td>
<td>
<asp:Label ID="Label14" runat="server"
Text="Label"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:Label ID="Label10" runat="server"
style="font-size: 8pt" Text="Line#:"></asp:Label>
</span>
</td>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:TextBox ID="TBLine" runat="server"
Width="27px"></asp:TextBox>
</span>
</td>
<td style="width: 71px">
</td>
<td>
</td>
</tr>
<tr>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:Label ID="Label11" runat="server"
style="font-size: 8pt" Text="Rings:"></asp:Label>
</span>
</td>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:TextBox ID="TBRings" runat="server"
Width="52px"></asp:TextBox>
</span>
</td>
<td style="width: 71px">
</td>
<td>
</td>
</tr>
</table>
</span>
</InsertItemTemplate>
</asp:FormView>
In Step 4 I have a button whose click event attempts to access the info in
these textboxes.
The button click has the following:
string txtStatus = "";
string txtLine = "";
string txtRings = "";
FormView FV1 = FindControl("FormView1") as FormView;
TextBox tbStatus = FV1.FindControl("TBStatus") as TextBox;
txtStatus = tbStatus.Text;
TextBox tbLine = FV1.FindControl("TBLine") as TextBox;
txtLine = tbLine.Text;
TextBox tbRings = FV1.FindControl("TBRings") as TextBox;
txtRings = tbRings.Text;
When I run it there is no data found in FormView1 and I get
Error - Object reference not set to an instance of an object.
Referring to Line - TextBox tbStatus = FV1.FindControl("TBStatus") as
TextBox;
How can I access the data in Wizard Step4 from the textboxes in table in
FormView1 created in Wizard Step2 ?
Hi,
I have a Wizard with several steps.
In Step 2 I have a FormView whose InsertItemTemplate contains a table that
has labels and textboxes that the user can update.
<asp:FormView ID="FormView1" runat="server"
OnPreRender="FV1_PreRender"
DefaultMode="Insert">
<InsertItemTemplate>
<span style="font-family: Verdana; font-size: 10pt;
color: navy;">
<table cellpadding="5" cellspacing="0" frame="border">
<tr>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:Label ID="Label15" runat="server"
style="font-size: 8pt" Text="Status:"></asp:Label>
</span>
</td>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:TextBox ID="TBStatus"
runat="server" Width="27px" Wrap="False"></asp:TextBox>
</span>
</td>
<td>
<asp:Label ID="Label14" runat="server"
Text="Label"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:Label ID="Label10" runat="server"
style="font-size: 8pt" Text="Line#:"></asp:Label>
</span>
</td>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:TextBox ID="TBLine" runat="server"
Width="27px"></asp:TextBox>
</span>
</td>
<td style="width: 71px">
</td>
<td>
</td>
</tr>
<tr>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:Label ID="Label11" runat="server"
style="font-size: 8pt" Text="Rings:"></asp:Label>
</span>
</td>
<td>
<span style="font-family: Verdana;
font-size: 10pt; color: navy;">
<asp:TextBox ID="TBRings" runat="server"
Width="52px"></asp:TextBox>
</span>
</td>
<td style="width: 71px">
</td>
<td>
</td>
</tr>
</table>
</span>
</InsertItemTemplate>
</asp:FormView>
In Step 4 I have a button whose click event attempts to access the info in
these textboxes.
The button click has the following:
string txtStatus = "";
string txtLine = "";
string txtRings = "";
FormView FV1 = FindControl("FormView1") as FormView;
TextBox tbStatus = FV1.FindControl("TBStatus") as TextBox;
txtStatus = tbStatus.Text;
TextBox tbLine = FV1.FindControl("TBLine") as TextBox;
txtLine = tbLine.Text;
TextBox tbRings = FV1.FindControl("TBRings") as TextBox;
txtRings = tbRings.Text;
When I run it there is no data found in FormView1 and I get
Error - Object reference not set to an instance of an object.
Referring to Line - TextBox tbStatus = FV1.FindControl("TBStatus") as
TextBox;
How can I access the data in Wizard Step4 from the textboxes in table in
FormView1 created in Wizard Step2 ?