Posts

Showing posts from October, 2012

ASP.NET Image Refresh after upload

Although the file was changing on the server, the file name was staying the same. This results in the browser displaying the old file as it is being retrieved by the browsers cache. To avoid this problem you need to add a unique querystring parameter to the image url. You can achieve this with the following code:   string lsTimeStamp = DateTime.Now.ToString("yyyyMMddhhmmss");    imgLoadimage.ImageUrl = " image url  +"?ts=" + lsTimeStamp;     

In javascript check the date is not grater than todays date

 <asp:TextBox ID="txtJoiningDatemain" runat="server" TabIndex="15"></asp:TextBox>  <AjaxControlToolkit:CalendarExtender ID="calJoiningDatemain" Format="dd/MM/yyyy"                                                                 runat="server" TodaysDateFormat="dd, MM, yyyy" TargetControlID="txtJoiningDatemain"                                                                 Enabled="True" OnClientDateSelectionChanged="checkDate">                                                             ...

Client Side Validation with JavaScript in ASP.NET

In jquery validate from date should not be greater than to date <asp:TextBox ID="txtEffectiveFrom" runat="server"></asp:TextBox> <AjaxControlToolkit:CalendarExtender ID="calEffectiveFrom" Format="dd/MM/yyyy" runat="server"      TodaysDateFormat="dd, MM, yyyy" TargetControlID="txtEffectiveFrom" Enabled="True" >  </AjaxControlToolkit:CalendarExtender >     <asp:TextBox ID="txtJoiningDatemain" runat="server" "></asp:TextBox>  <AjaxControlToolkit:CalendarExtender ID="calJoiningDatemain" Format="dd/MM/yyyy"     runat="server" TodaysDateFormat="dd, MM, yyyy" TargetControlID="txtJoiningDatemain"   Enabled="True" OnClientDateSelectionChanged="checkDate">   </AjaxControlToolkit:CalendarExtender> $('#txtEffectiveFrom').change(function () { ...

How to enable button and other checkbox on checkbox checked event in Jquery

Aspx: <asp:CheckBox ID="chkChanges" runat="server" Text=" Change Roles  " /> <asp:Button ID="btnChanges" runat="server" Text="Save Changes"  />  <asp:CheckBox ID="chkAdd" runat="server" Enabled="false" CssClass="chkaddclass" /> <script type="text/javascript">         $(function () {             $('#<%= chkChanges.ClientID  %>').click(function () {                 if ($(this).is(':checked')) {                     $('#<%= btnChanges.ClientID %>').removeAttr('disabled');                     $('.chkaddclass :first').removeAttr('disabled');                 }                 else {                     $...

How to maintain password textbox value during postback asp.net

Retain the Password textbox value during postback: In Page load add the following code: if (Ispostback) { if (!(String.IsNullOrEmpty(txtUserPassword.Text.Trim())) && !(String.IsNullOrEmpty(txtReTypePassword.Text.Trim())))  {         txtUserPassword.Attributes["value"] = txtUserPassword.Text.Trim();         txtReTypePassword.Attributes["value"] = txtReTypePassword.Text.Trim();   } } You can also clear the Password text box  by setting the value empty :   txtUserPassword.Attributes["value"] = string.Empty;    txtReTypePassword.Attributes["value"] = string.Empty;