Hi friends,
I want to upload a file on AJAX web page. The HTML code i m using is:
----------------------------------------------------------------------------------------
[code=html]
<asp:ScriptMana ger ID="ScriptManag er1" runat="server" />
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:FileUplo ad ID="FileUpload1 " runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click" Text="Button" />
</ContentTemplate >
</asp:UpdatePanel >
[/code]
-----------------------------------------------------------------------------------------
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.File Name;
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.
I want to upload a file on AJAX web page. The HTML code i m using is:
----------------------------------------------------------------------------------------
[code=html]
<asp:ScriptMana ger ID="ScriptManag er1" runat="server" />
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:FileUplo ad ID="FileUpload1 " runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click" Text="Button" />
</ContentTemplate >
</asp:UpdatePanel >
[/code]
-----------------------------------------------------------------------------------------
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.File Name;
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.
Comment