This is a migrated thread and some comments may be shown as answers.

How to use Regularexpressionvalidator in RadGrid control?

8 Answers 166 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Indranath
Top achievements
Rank 1
Indranath asked on 02 Jun 2011, 03:15 PM
Hi Guys,

How can I use regularexpressionvalidator in RadGrid control with <InsertTemplate> and <EditTemplate>. Is there any other alternative for this.

In case of regEx fail, I am able to display the '*' next to the control but not the message in ValidationSummary [rendering as display:none].

Thanks in advance.

-regards
Indra

8 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 02 Jun 2011, 07:41 PM
Hi,

plz refer below link and let me know if any concern

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/templateformupdate/defaultcs.aspx

Thanks,
Jayesh Goyani
0
Indranath
Top achievements
Rank 1
answered on 03 Jun 2011, 02:08 AM
I don't see validationsummary control used in this example.

Thanks
Indra
0
Princy
Top achievements
Rank 1
answered on 03 Jun 2011, 05:20 AM
Hello Indranath,

The following demo explains the flexible server-side validation mechanism of the RadGrid edit form. Check whether it helps you.

Grid / Flexible Server-side Validation.

Thanks,
Princy.
0
Indranath
Top achievements
Rank 1
answered on 03 Jun 2011, 02:10 PM
Princy thanks for your response, I am looking something client side validation using regularexpression.

-regards
Indra
0
Peter
Top achievements
Rank 1
answered on 07 Jul 2014, 07:16 AM
I too would like to know how to use a RegularExpressionValidator control on a GridBoundColumn ... is it possible? 
0
Princy
Top achievements
Rank 1
answered on 07 Jul 2014, 08:17 AM
Hi Peter,

Please try the following code snippet to have a RegularExpressionValidator for a GridBoundColumn.

C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
  if (e.Item is GridEditableItem && e.Item.IsInEditMode)
  {
   GridEditableItem item = e.Item as GridEditableItem;
   GridTextBoxColumnEditor editor = (GridTextBoxColumnEditor)item.EditManager.GetColumnEditor("ColumnUniqueName");
   TableCell cell = (TableCell)editor.TextBoxControl.Parent;
   RegularExpressionValidator validate = new RegularExpressionValidator();
   validate.ControlToValidate = editor.TextBoxControl.ID;
   validate.ValidationExpression = "Expression";
   validate.ErrorMessage = "Error Message";
   cell.Controls.Add(validate);
  }
}

Thanks,
Princy
0
Matt
Top achievements
Rank 1
answered on 21 Nov 2017, 03:51 PM
I know it's been a couple of years but in bulk edit mode, this event is not being raised.
0
Marin Bratanov
Telerik team
answered on 21 Nov 2017, 04:21 PM

Hi Matt,

The following article shows how to use a custom validator in batch edit mode: https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/validation.

If using that approach + the latest version does not help, I advise that you open a ticket and send us a small mockup that shows the issue.

Regards,

Marin Bratanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Indranath
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Indranath
Top achievements
Rank 1
Princy
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or