Search code examples
asp.nethtmlajaxcontroltoolkitmaskededitextender

Textbox with MaskedEditExtender not showing value when the Textbox.text is set


I am trying to set a value to a textbox which has MaskedEditExtender. Here is what is tried.

<cc1:TextBox ID="txtLastContributionDate" runat="server" 
   CssClass="TextBox" Enabled="true" MaxLength="7" ></cc1:TextBox>
<cc2:maskededitextender ID="meLastContributionDate" runat="server" 
   MaskType="Date" targetcontrolid="txtLastContributionDate" mask="99/9999" 
   inputdirection="RightToLeft" acceptnegative="Left" />

and in the code behind i am trying to set a value like this.

txtLastContributionDate.text = "09/2010" 

but its not displayed.

And here is what i am trying to do, i used MaskType = "Date" but want mask = "99/9999" which is like "MM/YYYY".


Solution

  • I researched a little bit and changed the values of MaskType = "None" and also added ClearMaskOnLostFocus = "False" and its working perfect.

    <cc2:maskededitextender ID="meLastContributionDate" runat="server" 
       MaskType="None" ClearMaskOnLostFocus="false" targetcontrolid="txtLastContributionDate" mask="99/9999" 
       inputdirection="RightToLeft" acceptnegative="Left" />