Click here to Skip to main content
15,884,047 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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???

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.
 
Share this answer
 
use Trigger on Script Manager :

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


// your content

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



in Submit name give your Save or Submit button name.

This will help you.
 
Share this answer
 
Comments
sadegh_rusta 29-Jun-12 10:21am    
i do this
but postback all of page content
use Trigger on Script Manager :

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


// your content

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



in Submit name give your Save or Submit button name.

This will help you.
 
Share this answer
 
Comments
sadegh_rusta 29-Jun-12 9:46am    
where i do my fileupload
[no name] 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?
[no name] 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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900