RSS

Monthly Archives: November 2012

Clearing ASP.Net FileUpload Control in Javascript


The following script will help you to clear the control……

<script language=”javascript”>

    function ClearfuBannerImage()

    {

    var fil = document.getElementById(“fuBannerImage”);

   fil.select();

   n=fil.createTextRange();

   n.execCommand(‘delete’);

   fil.focus();

    }

    </script>

 

<asp:FileUpload ID=”fuBannerImage” runat=”server” />

<asp:Button ID=”btnReset” runat=”server” OnClientClick=”ClearfuBannerImage()” Text=”Reset” />

 

 

 
Leave a comment

Posted by on November 25, 2012 in ASP Dot Net C#, Java Script

 

Asp Fileupload Control Allow only image files


alowing only image in file control you can use the following RegularExpressionValidator

<asp:FileUpload ID = “fuBannerImage” runat =”server” Width=”280px” style=”color:#999″ />

 

<asp:RegularExpressionValidator ID=”RegularExpressionValidator1″ runat=”server” ErrorMessage=”Only picture allowed!” ValidationExpression=”^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.png|.bmp|.gif|.GIF|.jpg|.JPG|.jpeg|.JPEG)$” ControlToValidate=”fuBannerImage” Display=”Dynamic”></asp:RegularExpressionValidator>

 

 
Leave a comment

Posted by on November 25, 2012 in ASP Dot Net C#

 

Tags: