Skip to main content

Posts

Showing posts from 2022

C# – FileUpload not working in Multiview and updatepanel

 <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel runat="server"> <Triggers> <asp:PostBackTrigger ControlID="Button1" /> </Triggers>     <ContentTemplate> <asp:MultiView ID="MultiView1" runat="server"                   ActiveViewIndex="0">                <asp:View ID="View1" runat="server">         <asp:Button Text="next"             runat="server" onclick="Unnamed1_Click" />     </asp:View>     <asp:View ID="View2" runat="server">     <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button"          style="width: 56px" />     <asp:FileUpload ID="fileupload2" runat="server" />     </asp:View> </asp:MultiView>  </Conten

Upload Image by using File Control with JS or Update Panel or C# DNN Partial Post back

 In this article i will show how you can upload image with partial post back and as well as using views  We need to create multi view and views and under view we have a form where the file upload control is present we need to place this script under this view otherwise partical post back in DNN stuck because controller will not found                        <script id="rendered-js" >    /* I use this code to get the image in base 64 and add in to the textbox to get the value in particle post back in next tab */               // Display image is preview function          function displayImage() {              document.querySelector("#demoImage").src = document.querySelector("#<%=txt_imgValue.ClientID%>").value;          }           // Get the file upload control image read it in to base 64 value the plus point for it either you can store the whole image in db as a text or save it as file after rendering it.             function ReceiveImageInto_B