Wednesday, November 14, 2012

Clear FileUpload filename

We can do this using javascript. Please refer below code sample


<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type="text/javascript">
    function clearFileInputField(divId) {
        document.getElementById(divId).innerHTML = document.getElementById(tagId).innerHTML;
    }
</script>
    <asp:Label ID="Label1" runat="server"></asp:Label>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div id="divFileUp3">
  <asp:FileUpload ID="fileUpload1" runat="server"   />
</div><asp:Button runat="server" Text="Remove" OnClientClick="clearFileInputField(divFileUp3)"/>
    </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
 

No comments:

Post a Comment

How to Create Events Using Microsoft Graph API with Delegated Permissions and MSAL.js

Microsoft Graph API provides powerful capabilities to interact with Microsoft 365 services. In this guide, we’ll explore how to create calen...