[英]Access control in a number of tags from codebehind
我有這樣的結構
<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"...
如何在代碼隱藏中訪問FileUpload控件? 如果沒有並且它很簡單,例如upFile.FileName但是如果它在這個標簽中是錯誤的:
The name 'upFile' does not exist in the current context
怎么改呢?
我不知道LayoutTemplate
是如何工作的,但你可以試試這個:
FileUpload upFile = (FileUpload)LoginControl.FindControl("upFile");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.