I want to upload a file on AJAX web page. The HTML code i m using is:
----------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
- <asp:ScriptManager ID="ScriptManager1" runat="server" />
- <asp:UpdatePanel ID="UpdatePanel1" runat="server">
- <ContentTemplate>
- <asp:FileUpload ID="FileUpload1" runat="server" />
- <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
- </ContentTemplate>
- </asp:UpdatePanel>
The problem is that when i run the program the page gets Auto postback and the value in the fileUpload gets cleared. and the error of "object reference cannot be set to null" comes on the below line.....
string st=FileUpload1.PostedFile.FileName;
I tried using viewstate but still the problem is of Autopostback......
No effect with triggers and update mode set to conditional....Please help me out.