自定义验证器到GridBoundColumn

时间:2014-12-08 14:17:22

标签: telerik telerik-grid

我在我的页面中使用telerik网格,如下所示:

<telerik:RadGrid ID="rgBlog" runat="server" Skin="Default" SkinID="list" AllowPaging="false" AllowSorting="True"
                GridLines="None" BorderWidth="0" OnNeedDataSource="rgBlog_NeedDataSource" EnableEmbeddedSkins="false"
                OnUpdateCommand="rgBlog_UpdateCommand" AutoGenerateColumns="False" OnDeleteCommand="rgBlog_DeleteCommand"
                OnItemCommand="rgBlog_ItemCommand" OnItemCreated="rgBlog_ItemCreated">
                <MasterTableView AllowMultiColumnSorting="True" DataKeyNames="CategoryID" EditMode="InPlace">
                    <Columns>
                        <telerik:GridBoundColumn DataField="CategoryName" HeaderText="Category Name" SortExpression="CategoryName"
                            UniqueName="CategoryName">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="Action">
                            <EditItemTemplate>                              
                                <asp:ImageButton ID="imgBtnUpdate" runat="server" ToolTip="Save" CommandName="Update"
                                    CommandArgument='<%#Eval("CategoryID") %>' ImageUrl="~/Images/icon/save.png" ValidationGroup="EditCategory"/>
                                <asp:ImageButton ID="ImageButton1" runat="server" ToolTip="Cancel" CausesValidation="false" CommandName="Cancel"
                                    CommandArgument='<%#Eval("CategoryID") %>' ImageUrl="~/Images/icon/close.png" />
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:ImageButton ID="imgBtnModify" runat="server" ToolTip="Edit" CausesValidation="false" CommandName="Edit"
                                    CommandArgument='<%#Eval("CategoryID") %>' SkinID="imgEdit" />
                                <asp:Label runat="server" ID="lblDel" Visible="<%# ((CollaborationCategoryEntity)Container.DataItem).ItemCount==0 %>">
                                <asp:ImageButton ID="imgBtnDelete" runat="server" CausesValidation="False" CommandName="Delete" CommandArgument='<%#Eval("CategoryID") %>'
                                    SkinID="imgDelete" ToolTip="Delete" OnClientClick="return funOnClientClick_Confirm(this,'Are you sure you want to permanently delete this category?');"
                                    meta:resourcekey="imgBtnDeleteResource1" />
                                </asp:Label>
                            </ItemTemplate>
                            <ItemStyle Width="100px" HorizontalAlign="Center" />
                            <HeaderStyle HorizontalAlign="center" />
                        </telerik:GridTemplateColumn>
                    </Columns>
                    <NoRecordsTemplate>
                        <div class="nodata">
                            No Record</div>
                    </NoRecordsTemplate>
                </MasterTableView>
            </telerik:RadGrid>

我想将自定义验证器添加到名为CategoryName的GridBoundColumn中。如何添加自定义验证器?

请建议。

1 个答案:

答案 0 :(得分:0)

也许你已经找到了这个,但万一其他人来这里看,http://www.telerik.com/forums/custom-validator-for-a-textbox-in-the-grid