0

I am having an issue Finding a few controls. They are in a FormView.

<asp:Panel ID="Panel5" runat="server">
                <table cellpadding="3" cellspacing="2" class="formInnerTable">
                    <tr>
                        <td>
                                <asp:UpdatePanel ID="UpdatePanel4" runat="server">
                                <Triggers >
                                    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
                                    <asp:AsyncPostBackTrigger ControlID="bttnSavee" EventName="Click" />
                                </Triggers>
                            <ContentTemplate>
                                <asp:HiddenField ID="HidVendor" runat="server" />
                        </td>
                        </tr>
                        <tr>
                            <td>
                                    <asp:FormView ID = "FVedit" DefaultMode = "Edit" runat = "server" 
                                    DataSourceID="SqlDataSource5">
                                    <EditItemTemplate>
                                        <table>
                                            <tr>
                                                <td align="center" colspan = "2">
                                                    <font color="blue" size="Medium">
                                                    <asp:Label ID="Label11" runat="server" Text='<%# Bind("data") %>'></asp:Label>(
                                                    <asp:Label ID="TextBox3" ForeColor = "blue" runat="server" Text='<%# Bind("data") %>'></asp:Label>)
                                                    </font>
                                                    <br /><br>
                                                </td>
                                            </tr>
                                            <tr align="left">
                                        <td align="right">
                                            <asp:Label ID="Label2" runat="server" Text="As2 ID: "></asp:Label>
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtAs2IDe" runat="server" MaxLength = "30" Text='<%# Bind("data") %>'></asp:TextBox>
                                            <asp:RequiredFieldValidator
                                            ID="RFVe"  Display="Dynamic" ControlToValidate = "txtAs2IDe" runat="server" ErrorMessage="You must Insert a Production AS2 Identifier."> </asp:RequiredFieldValidator>
                                             <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender1e" TargetControlID="RFVe" HighlightCssClass="validatorCalloutHighlight" runat="server">
                                             </ajaxToolkit:ValidatorCalloutExtender>
                                        </td>

**I want access to all those controls in FVedit ** In the code behind I have access to FVedit, but i noticed that the controls count for this formview is only one when there are many controls in it.

How can i get access to those controls in code?

Adrian Grigore
  • 33,034
  • 36
  • 130
  • 210
Eric
  • 7,930
  • 17
  • 96
  • 128

2 Answers2

0

The "one" control, is likely to be something like the template - I'm fairly (but not 100%) sure that you'll have to get the "TemplateItem" (I'm not entirely sure what the name of this control would be).

Alternatively, use (TextBox)FVedit.FindControl("txtAs2IDe") to get the controls in there - this seems to be quite a common approach

Paul
  • 9,409
  • 13
  • 64
  • 113
  • yeah. I know how to do that. that is the same thing as Direct Casting in VB but it won't work because the one control it finds is not a textbox - It's an html control. – Eric Sep 03 '09 at 19:27
0

I can get access in the Formview's Databound.

That's how you do it.

Eric
  • 7,930
  • 17
  • 96
  • 128