Access control in a number of tags from codebehind

348 Views Asked by At

I've such a structure

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:Login ID="LoginControl" runat="server" onauthenticate="LoginControl_Authenticate" >
        <LayoutTemplate>
            <table>
                <tr>
                    <td>
                        <asp:UploadFile ID="upFile"...
                    <td>
                        <asp:Button ID="LoginButton" onclick="LoginButton_Click"...

How get access to FileUpload control in codebehind? If there's no and it's simple e.g. upFile.FileName But if it's in this tags ther's error:

The name 'upFile' does not exist in the current context

How to change it?

1

There are 1 best solutions below

2
On BEST ANSWER

I don't know how that LayoutTemplate works, but you can try this:

FileUpload upFile = (FileUpload)LoginControl.FindControl("upFile");