MaskedEditExtender with existing

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>
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top