I have created a formview that is bound to a table in an Access database with an AccesDataSource object.
How do I pass the values contained in the labels in the formview to unbound textboxes outside of the formview
<asp:FormView ID="FormView1" runat="server" DataSourceID="AccessDataSource2" Width="519px" Visible =false HeaderText="Company Address" HeaderStyle-Font-Bold="true" > <ItemTemplate> <table style="width: 557px; height: 91px"> <tr> <td style="width: 100px">
Address:
</td> <td style="width: 100px">City:
</td> <td style="width: 100px">PostalCode:
</td> </tr> <tr> <td style="width: 100px; height: 20px"> <asp:Label ID="AddressLabel" runat="server" Text='<%# Bind("Address") %>'></asp:Label></td> <td style="width: 100px; height: 20px"> <asp:Label ID="CityLabel" runat="server" Text='<%# Bind("City") %>'></asp:Label></td> <td style="width: 100px; height: 20px"> <asp:Label ID="PostalCodeLabel" runat="server" Text='<%# Bind("PostalCode") %>'></asp:Label></td> </tr> <tr> <td style="width: 100px">Country:
</td> <td style="width: 100px">Phone:
</td> <td style="width: 100px">Fax:
</td> </tr> <tr> <td style="width: 100px"> <asp:Label ID="CountryLabel" runat="server" Text='<%# Bind("Country") %>'></asp:Label></td> <td style="width: 100px"> <asp:Label ID="PhoneLabel" runat="server" Text='<%# Bind("Phone") %>'></asp:Label></td> <td style="width: 100px"> <asp:Label ID="FaxLabel" runat="server" Text='<%# Bind("Fax") %>'></asp:Label></td> </tr> </table> </ItemTemplate></
asp:FormView>I want to fill unbound textboxes outside of this form with the values of the labels contained in the formview

Pass Values from Formview child controls to unbound textbox
Mark Bennett112838
I has the same problem, at have used hours on solvine it. But here is a C# version that works for me.
TextBox
myTextBox = ((TextBox)this.FormView1.FindControl("SomeTextBox"));Hope my anserwer is not to late for yor.
DigitalColony
Neil Watson
DebsPink
JoeChip90
MNMamun
M. Paydar
The following button event makes the unbound textboxes visible, and, I pass the text in the labels that are in the form view to these.
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
lblShippingInfo.Visible = True
lblShipName.Visible = True
lblShipAddress.Visible = True
lblCity.Visible = True
ShipName.Visible = True
City.Visible = True
lblShipPostalCode.Visible = True
lblCountry.Visible = True
ShipPostalCode.Visible = True
ShipCountry.Visible = True
ShipAddress.Text = CType(CType(FormView1.FindControl("Address"), TextBox).Text, String)
ShipAddress.Visible = True
I've also tried
ShipAddress = CType(FormView1.FindControl("Address"), TextBox)
ShipAddress.Visible = True
I always end up with "Object reference not set to an instance of an object" error message
zmrcic
Dim a As String = CType(Me.FormView1.FindControl("AddressLabel"), Label).Text
ShipAddress.Text = a
ShipAddress.Visible = True