gridview编辑模式下的屏蔽文本时间(HH.mm.ss)

时间:2012-09-19 11:44:44

标签: gridview editmode

我需要限制在gridview编辑模式下只输入时间(HH:mm:ss)我该怎么办?

 <asp:GridView runat="server" ID="gvListele" Visible="False"
     CellPadding="4" ForeColor="#333333" GridLines="Horizontal" Width="950px" RowStyle-Height="30px" 
                onselectedindexchanged="gvListele_SelectedIndexChanged" 
                onsorting="gvListele_Sorting" 
                onpageindexchanging="gvListele_PageIndexChanging" 
                onrowcancelingedit="gvListele_RowCancelingEdit" 
                onrowediting="gvListele_RowEditing" 
                onrowupdating="gvListele_RowUpdating" 
                onrowdeleting="gvListele_RowDeleting" 
                onrowdatabound="gvListele_RowDataBound" PageSize="20" 
                EmptyDataText="Görüntülenecek Öğe Bulunmamaktadır....." >
        <RowStyle BackColor="#FFFBD6" ForeColor="#333333" HorizontalAlign="Center"/>
        <Columns>

            <asp:CommandField CancelText="İptal" DeleteText="Sil" EditText="Düzenle" 
                InsertText="Ekle" NewText="Yeni" SelectText="Seç" ShowEditButton="True" 
                UpdateText="Güncelle" />
            <asp:CommandField CancelText="İptal" DeleteText="Sil" EditText="Düzenle" 
                ShowDeleteButton="True" />
        </Columns>
       <FooterStyle BackColor="#29abe2" ForeColor="White" HorizontalAlign="Center" />
        <PagerStyle BackColor="#29abe2" ForeColor="#333333"
         HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#29abe2" ForeColor="Navy" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#29abe2" ForeColor="White" HorizontalAlign="Center" Font-Size="Small" Height="20px" />
        <AlternatingRowStyle BackColor="White" />

    </asp:GridView>

这是我的gridview代码,我只需要在编辑模式下屏蔽columb 4,5和6。

1 个答案:

答案 0 :(得分:0)

你可以这样使用;

<Columns>
<asp:TemplateField HeaderText="Header Text">
    <ItemTemplate>
        <asp:TextBox ID="txt" runat="server" Width="150" ValidationGroup="MKE" ></asp:TextBox>
        <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" 
            TargetControlID="txt" 
            Mask="99,99,9999 99:99"
            MessageValidatorTip="true"
            OnFocusCssClass="MaskedEditFocus"
            OnInvalidCssClass="MaskedEditError"
            MaskType="DateTime"
            AcceptAMPM="True"
            ErrorTooltipEnabled="True"/>
        <asp:MaskedEditValidator ID="MaskedEditValidator1" runat="server" 
            ControlExtender="MaskedEditExtender1"
            ControlToValidate="txt"
            IsValidEmpty="False"
            EmptyValueMessage="EmptyValueMessage"
            InvalidValueMessage="InvalidValueMessage"
            Display="Dynamic"
            TooltipMessage="TooltipMessage"
            EmptyValueBlurredText="EmptyValueBlurredText"
            InvalidValueBlurredMessage="InvalidValueBlurredMessage"
            ValidationGroup="MKE" />
    </ItemTemplate>
</asp:TemplateField>