I've upgraded to the latest ajax toolkit and now and having problems with the maskededitextender. It works great when my users are filling out forms but when I try to display the contents of the form later on, I cannot get the dates to populate. I narrowed things down to a small piece of code to demonstrate.
Here is the html for a textbox and mask:
<asp:TextBox ID="tbDOB" runat="server" MaxLength="20"></asp:TextBox>
<asp:MaskedEditExtender ID="MaskedEditDOB" runat="server" Mask="99/99/9999" MaskType="Date" TargetControlID="tbDOB" />
And in the vb.net code behind the page, I simply want to populate that textbox as follows:
tbDOB.text = "1/1/2015"
(Normally, this would be a date retrieved from the database - this is easier to see the issue)
When I load the page, the textbox appears with the mask (__/__/____) but does not put 1/1/2015 in the box.
What am I doing wrong? I swear this was working before I updated the toolkit so perhaps there is a different way to handle dates in the extender? If I get rid of the mask, then the date populates without a problem.
Comments: I spoke too soon. Was looking at the wrong textbox. I still cannot populate a date in the textbox. I have set the culture and UIculture to "en-US" in the page tag. I have tried setting the culture in the web.config globalization settings. I have tried specifying the UserDateFormat="MonthDayYear" but nothing helps. Are you able to successfully populate a maskededitextender textbox with an English date? If you can, could you post the lines of code? I am really having a hard time figuring out what is wrong. I have tried both auto and en-US. So what I have now is: These two items are in the page tag at the top of the aspx page: Culture="en-US" UICulture="en-US" Here is the html tag: <asp:TextBox ID="tbStartDate" runat="server" MaxLength="20" ></asp:TextBox> <asp:MaskedEditExtender ID="MaskedStartDate" runat="server" Mask="99/99/9999" UserDateFormat="MonthDayYear" MaskType="Date" TargetControlID="tbStartDate"> </asp:MaskedEditExtender> Here is the code behind: tbStartDate.Text = "12/28/2015" Am hoping someone can post a working solution that I can compare to.
Here is the html for a textbox and mask:
<asp:TextBox ID="tbDOB" runat="server" MaxLength="20"></asp:TextBox>
<asp:MaskedEditExtender ID="MaskedEditDOB" runat="server" Mask="99/99/9999" MaskType="Date" TargetControlID="tbDOB" />
And in the vb.net code behind the page, I simply want to populate that textbox as follows:
tbDOB.text = "1/1/2015"
(Normally, this would be a date retrieved from the database - this is easier to see the issue)
When I load the page, the textbox appears with the mask (__/__/____) but does not put 1/1/2015 in the box.
What am I doing wrong? I swear this was working before I updated the toolkit so perhaps there is a different way to handle dates in the extender? If I get rid of the mask, then the date populates without a problem.
Comments: I spoke too soon. Was looking at the wrong textbox. I still cannot populate a date in the textbox. I have set the culture and UIculture to "en-US" in the page tag. I have tried setting the culture in the web.config globalization settings. I have tried specifying the UserDateFormat="MonthDayYear" but nothing helps. Are you able to successfully populate a maskededitextender textbox with an English date? If you can, could you post the lines of code? I am really having a hard time figuring out what is wrong. I have tried both auto and en-US. So what I have now is: These two items are in the page tag at the top of the aspx page: Culture="en-US" UICulture="en-US" Here is the html tag: <asp:TextBox ID="tbStartDate" runat="server" MaxLength="20" ></asp:TextBox> <asp:MaskedEditExtender ID="MaskedStartDate" runat="server" Mask="99/99/9999" UserDateFormat="MonthDayYear" MaskType="Date" TargetControlID="tbStartDate"> </asp:MaskedEditExtender> Here is the code behind: tbStartDate.Text = "12/28/2015" Am hoping someone can post a working solution that I can compare to.