[英]Access control in a number of tags from codebehind
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? 如何在代码隐藏中访问FileUpload控件? If there's no and it's simple eg upFile.FileName But if it's in this tags ther's error:
如果没有并且它很简单,例如upFile.FileName但是如果它在这个标签中是错误的:
The name 'upFile' does not exist in the current context
How to change it? 怎么改呢?
我不知道LayoutTemplate
是如何工作的,但你可以试试这个:
FileUpload upFile = (FileUpload)LoginControl.FindControl("upFile");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.