使用 "for" 属性打开文件对话框
Open File Dialog box using "for" attribute
我想在母版页的 link 上有一个“打开文件”对话框。
它在我的网页中有效,但在母版页中无效。
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div class="img-uploader left">
<label id="img-upload-trigger" for="FileUploadPic">
<img src="img/image.png" alt="">
</label>
<asp:FileUpload ID="FileUploadPic" onchange="this.form.submit()" runat="server" />
</div>
</asp:Content>
在服务器控件中使用 ClientIDMode="Static"
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div class="img-uploader left">
<label id="img-upload-trigger" for="FileUploadPic">
<img src="img/image.png" alt="">
</label>
<asp:FileUpload ID="FileUploadPic" onchange="this.form.submit()" runat="server" ClientIDMode="Static"/>
</div>
我想在母版页的 link 上有一个“打开文件”对话框。 它在我的网页中有效,但在母版页中无效。
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div class="img-uploader left">
<label id="img-upload-trigger" for="FileUploadPic">
<img src="img/image.png" alt="">
</label>
<asp:FileUpload ID="FileUploadPic" onchange="this.form.submit()" runat="server" />
</div>
</asp:Content>
在服务器控件中使用 ClientIDMode="Static"
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div class="img-uploader left">
<label id="img-upload-trigger" for="FileUploadPic">
<img src="img/image.png" alt="">
</label>
<asp:FileUpload ID="FileUploadPic" onchange="this.form.submit()" runat="server" ClientIDMode="Static"/>
</div>