Click here to Skip to main content
14,239,739 members
Rate this:
Please Sign up or sign in to vote.
i have a updatepane;
in this update panel is a panel
in this panel is a fileUpload and a Button
i do clicked on the fileupload and select a file,
and when click on the button return ""
in my button_click is this code:
button1.text= filaeupload1.filename;
why return null value?


my code is this:
<asp:panel ....>

<asp:updatepanel ....>
<content template="">

<asp:fileupload ....>
<asp:button ...onclick="clickonbutton">

br mode="hold" />

br mode="hold" />
and in "clickonbutton " is this code :

button1.text=fileupload1.filename;

this code always return null("")

when i do delete update panel from mproject is true and my project returned filename of selected file


in tha latest ,i want can only selectable jpg file
Posted
Updated 29-Jun-12 2:13am
v2
Comments
ajay.anilmaddi 29-Jun-12 7:48am
   
I cant understand Ur Problem,
Please improve Ur Question???
Rate this:
Please Sign up or sign in to vote.

Solution 2

Hi,


After reading your comments what i understand is, you need to upload file Asynchronously. you can not use default Fileuploaded with Update panel to upload file. you need to use some thirdparty control for Asynchronous file uploading.

Read Asynchronous File Upload[^] Article. this may help you,

Thanks
-Amit.
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

use Trigger on Script Manager :

<asp:ScriptManager ID="sc1" runat="server">
         </asp:ScriptManager>
         <asp:UpdatePanel ID="u1" runat="server">
             <ContentTemplate>


// your content

</ContentTemplate>
                <Triggers>
                    <asp:PostBackTrigger ControlID="Submit" />
                </Triggers>
            </asp:UpdatePanel>



in Submit name give your Save or Submit button name.

This will help you.
   
Comments
sadegh_rusta 29-Jun-12 10:21am
   
i do this
but postback all of page content
Rate this:
Please Sign up or sign in to vote.

Solution 4

use Trigger on Script Manager :

<asp:ScriptManager ID="sc1" runat="server">
         </asp:ScriptManager>
         <asp:UpdatePanel ID="u1" runat="server">
             <ContentTemplate>


// your content

</ContentTemplate>
                <Triggers>
                    <asp:PostBackTrigger ControlID="Submit" />
                </Triggers>
            </asp:UpdatePanel>



in Submit name give your Save or Submit button name.

This will help you.
   
Comments
sadegh_rusta 29-Jun-12 9:46am
   
where i do my fileupload
Mits Machhi 30-Jun-12 0:12am
   
Put file upload and all other things between Content Template.
sadegh_rusta 30-Jun-12 16:34pm
   
how is triggers tag?
Mits Machhi 2-Jul-12 0:11am
   
because when you upload file it makes Postback and your upload file becomes null and that`s why using postback trigger applied on submit button , it postback only when Submit button click not at upload a file and you save a upload file Easily.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100