I have a small problem.
I have got a fileupload control inside the update panel.
and when i upload a file in it,it doesnt contains the file.

if(fileupload1.hasfile)
{

}

this statement doesnt get execution. the condition doesnt satisfies.
so i got one solution for it.. Make the fileupload control to do Autopostback.
now to make it autopost back i have to register it.
So i want your help in this case that HOW TO REGISTER FILEUPLOAD CONTROL IN ASP.NET

I have a small problem.
I have got a fileupload control inside the update panel.
and when i upload a file in it,it doesnt contains the file.

if(fileupload1.hasfile)
{

}

this statement doesnt get execution. the condition doesnt satisfies.
so i got one solution for it.. Make the fileupload control to do Autopostback.
now to make it autopost back i have to register it.
So i want your help in this case that HOW TO REGISTER FILEUPLOAD CONTROL IN ASP.NET

Select UpdatePanel1 control and set postbacktrigger triggers. (Don't select AsyncPostBack trigger)

<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>
        <Triggers>
            <asp:PostBackTrigger ControlID="Button1" />
        </Triggers>
    </asp:UpdatePanel>
protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(MapPath("~/" + FileUpload1.FileName));
        }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.