FileUpload Doesn’t Work When Nested In UpdatePanel? C#

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:FileUpload onchange="clickTheButton();" ID="FileUpload1" runat="server" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" /> </Triggers> </asp:UpdatePanel> Button 1 is outside the update panel and the javascript that gets run when a user adds a file in the upload box is this: function clickTheButton() { document.getElementById('<%= Button1.ClientID %>').click(); } The problem is simple. FileUpload1.HasFile == false. … Read more

Retain value in fileupload control

I am writing a file upload application. So it contains a keyname in textbox and a fileupload
control. A save button is used to save the keyname and the file. My issue is when I select a file in fileupload control and I donot enter any value in keyname textbox and click on save button, a message is shown ‘enter a keyname’ but the fileupload control is cleared. How can retain the value in the fileupload control?