hi,
Here is the sample code am trying.
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional">
<Triggers>
<asp:PostBackTrigger ControlID="Button1" />
</Triggers>
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Upload" OnClick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
{ string fileName = string.Empty;
if (FileUpload1.HasFile)
{
fileName = FileUpload1.FileName;
FileUpload1.SaveAs(Server.MapPath("~/Images/") + fileName);
// img.ImageUrl = "~/Images/" + fileName;
}
}
This upload is working. But why the page is getting refreshed? this is not partial post back and instead it 's full post back. i have read the articles for the fileuplaod with issue inside the update panel. is there any way to achieve this asynchronous upload on button click?
I don't want to use the Ajaxtoolkit Asyncupload because that will upload(ref : http://www.aspsnippets.com/Articles/Display-image-after-upload-without-page-refresh-or-postback-using-ASP.Net-AsyncFileUpload-Control.aspx) the moment when we seelct the file itself which i don't want to do that. i need to do on the button click event.
Any sugestions or samples