Note that there are some explanatory texts on larger screens.

plurals
  1. POfileupload not found in a accordion
    text
    copied!<p>Ihave a problam with a fileupload control i have an accordion and inside the ContentTemplate i have a fileupload control and when the send button is been submited i am trying to find the control but getting it null al the time.</p> <pre><code>&lt;asp:Accordion ID="Accordion1" runat="server" AutoSize="None" FramesPerSecond="40" SelectedIndex="-1" TransitionDuration="100" FadeTransitions="true" RequireOpenedPane="false" SuppressHeaderPostbacks="true" ContentCssClass="accordionContent" HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected" OnItemCommand="Accordion1_ItemCommand" onitemdatabound="Accordion1_ItemDataBound"&gt; &lt;HeaderTemplate&gt; &lt;%#DataBinder.Eval(Container.DataItem, "order_id")%&gt; &lt;asp:Label ID="lblOrderID" runat="server" Text='&lt;%#Eval("description")%&gt;'&gt;&lt;/asp:Label&gt; &lt;/HeaderTemplate&gt; &lt;ContentTemplate&gt; &lt;asp:Label ID="lblNotes" runat="server" Text='&lt;%#Eval("notes")%&gt;'&gt;&lt;/asp:Label&gt; &lt;asp:Label ID="lbltext" runat="server" Text='להגשת מועמדות למשרה זו צרף קו"ח'&gt;&lt;/asp:Label&gt; &lt;asp:FileUpload ID="FileUpload1" runat="server" /&gt; &lt;asp:Button ID="btnSend" runat="server" Text="שלח" CommandName="send" /&gt; &lt;/ContentTemplate&gt; &lt;/asp:Accordion&gt; </code></pre> <hr> <pre><code> protected void Accordion1_ItemCommand(object sender, CommandEventArgs e) { if (e.CommandName == "send") { FileUpload fu = new FileUpload(); fu = (FileUpload) FindControl("FileUpload1"); if (fu.HasFile) { SmtpClient client = new SmtpClient(); MailAddress from = new MailAddress("", "יש לך הודעה חדשה", System.Text.Encoding.UTF8); MailAddress to = new MailAddress(""); MailMessage message = new MailMessage(from, to); message.Body = ""; //Attachment data = new Attachment(FileUpload. //message.Attachments.Add(FindControl("fu")); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload