Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I have First one image upload (File Upload) & second one TextBox, now my issue is whenever click submit button if there is no data in textbox it will show error, at the same time the choosen file also refreshed. How to give error message without refreshing the choosen file?


Thanks in Advanced.
Posted
Comments
pradiprenushe 6-Aug-14 3:02am    
what error?

1 solution

Quote:
place textbox and label inside updatepanel and write trigger for button click event like below then fileupload control value wont be changed


XML
<div>
       <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

               <asp:FileUpload ID="FileUpload1" runat="server" />

       <asp:UpdatePanel ID="updatepnl" runat="server">
           <ContentTemplate>
       <asp:Label ID="lblmsg" runat="server" Text=""></asp:Label>
       <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </ContentTemplate>
           <Triggers >
                 <asp:AsyncPostBackTrigger ControlID="Button1" EventName="click" />
           </Triggers>
       </asp:UpdatePanel>
       <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
   </div>
 
Share this answer
 

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