MaskedEditExtender with existing

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

I am trying to use the Ajax toolkit control MaskedEditExtender. I find that
when I use it on a control that already has a date in it the date goes away
in edit. Can I make it so that the date and time that is already bound
shows up in the mask? Below is what I am using in my GridView. Thanks.
David

<asp:TemplateField HeaderText="Start Time"
SortExpression="StartTime">
<EditItemTemplate>
<asp:TextBox ID="txtStartTime" runat="server"
Text='<%# Bind("StartTime") %>'></asp:TextBox>
<cc1:MaskedEditExtender ID="MaskedEditExtender1"
runat="server" AcceptAMPM="True"
TargetControlID="txtStartTime"
MaskType="DateTime" Mask="99/99/9999 99:99">
</cc1:MaskedEditExtender>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="LblStartTime" runat="server"
Text='<%# Bind("StartTime", "{0:h:mm tt}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
 
I am trying to use the Ajax toolkit control MaskedEditExtender. I find that
when I use it on a control that already has a date in it the date goes away
in edit.  Can I make it so that the date and time that is already bound
shows up in the mask?  Below is what I am using in my GridView.  Thanks.
David

                <asp:TemplateField HeaderText="Start Time"
SortExpression="StartTime">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtStartTime" runat="server"
Text='<%# Bind("StartTime") %>'></asp:TextBox>
                        <cc1:MaskedEditExtender ID="MaskedEditExtender1"
runat="server" AcceptAMPM="True"
                                TargetControlID="txtStartTime"
MaskType="DateTime" Mask="99/99/9999 99:99">
                        </cc1:MaskedEditExtender>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="LblStartTime" runat="server"
Text='<%# Bind("StartTime", "{0:h:mm tt}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>

Hi David,

please look at the following example, I think this is exactly how you
want to do this
http://www.obout.com/grid/grid_integration_ajax_toolkit.aspx

Hope this helps
 
Back
Top