RadGrid for ASP.NET

RadGrid Send comments on this topic.
ValidationSettings Property
See Also  Example
Telerik.WebControls Namespace > RadGrid Class : ValidationSettings Property


Gets a reference to the GridValidationSettings object that allows you to set the properties of the validate operation in a Telerik RadGrid control.

  

 

Namespace: Telerik.WebControls
Assembly: RadGrid (in RadGrid.dll)

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property ValidationSettings As GridValidationSettings
Visual Basic (Usage)Copy Code
Dim instance As RadGrid
Dim value As GridValidationSettings
 
value = instance.ValidationSettings
C# 
public GridValidationSettings ValidationSettings {get;}

Return Value

A reference to the GridValidationSettings that allows you to set the properties of the validate operation in a Telerik RadGrid control.

Example

The following code example demonstrates how to set the ValidationSettings property declaratively. It sets the validation for the PerformInsert command event of the TextBox1 control.
Visual BasicCopy Code
<%@ Page Language="VB" %>

<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <rad:RadGrid
            DataSourceID="SqlDataSource1"
            ID="RadGrid1"
            AutoGenerateColumns="false"
            runat="server">
            <ValidationSettings
                EnableValidation="true"
                CommandsToValidate="PefrormInsert" />
                <MasterTableView CommandItemDisplay="TopAndBottom">
                    <Columns>
                        <rad:GridEditCommandColumn>
                        </rad:GridEditCommandColumn>
                        <rad:GridTemplateColumn HeaderText="ContactName" UniqueName="ContactName" DataField="ContactName">
                            <ItemTemplate>
                                <%# Eval("ContactName") <see cref="TextBox Text='<">>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp</see># Bind("ContactName") %>' ID="TextBox1" runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ControlToValidate="TextBox1" ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                        </rad:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
        </rad:RadGrid>
        <!-- This example uses Microsoft SQL Server and connects -->
        <!--