Double click on the Custom Validator control to go into the Server Validate event handler and write the following code in it. However, at times you many need more control and flexibility than that is provided by validation controls.Here, our validation criteria is that the entered name must not contain title of courtesy (Mr./Mrs./Ms.). That is when you can handle certain events of Grid View control.On the next step select Customer ID, Company Name, Contact Name and Country columns (Figure 2).
Here is the source view; [html] <asp: Script Manager runat="server" ID="sm1"></asp: Script Manager> <asp: Update Panel ID=" Update Panel1" runat="server" Update Mode=" Conditional"> < Content Template> <wijmo: C1Grid View ID=" C1Grid View1" runat="server" Data Key Names=" Product ID" Callback Settings-Action=" Editing" On Client After Cell Edit="on After Cell Edit" On Client Before Cell Edit="on Before Cell Edit" On Client Before Cell Update="on Before Cell Update" Allow Client Editing="true" Auto Generate Columns="false" Show Row Header="true"> < Columns> <wijmo: C1Bound Field Data Field=" Product ID" Header Text=" Product ID" Read Only="true" /> <wijmo: C1Bound Field Data Field=" Product Name" Header Text=" Product Name" /> <wijmo: C1Bound Field Data Field=" Supplier ID" Header Text=" Supplier ID" /> <wijmo: C1Check Box Field Data Field=" Discontinued" Header Text=" Discontinued" /> </Columns> </wijmo: C1Grid View> <div id="ddl Parent"> <asp: Drop Down List runat="server" ID="suppliers DDL" Data Text Field=" Company Name" Data Value Field=" Supplier ID" style="visibility:hidden; width:auto" /> </div> </Content Template> </asp: Update Panel> [/html] Assigning Custom Editor to the cell You need to handle the ' void C1Grid View1_Row Updating(object sender, C1.
If you face any issues while implementing the code or have any suggestions then feel free to post on our forums.
You should see an error message as shown in Figure 7.
This way you can attach client side validation controls to the Grid View columns.
Note that by default all validation controls validate on the client side.
Right click on the Grid View and select "End template editing" Run the web form.
In order to do so select "Edit Columns..." from the smart tag of the Grid View. Select Company Name and Contact Name fields and click on "Covert this field into a Template Field" link.
This will convert them from Bound Field to Template Field.
Now from the smart tag of the Grid View choose "Edit Template" and then select "Edit Item Template" of Company Name column.
This will display the template designer for the column as shown in Figure 6.
On the first step of the wizard click on "New Connection" button to open a dialog as shown in Figure 1.