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

Rad Grid Edit Form Control Validations

2 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Trs
Top achievements
Rank 1
Trs asked on 04 Jan 2013, 04:56 AM
Hi,
I'm new to teleriks.Anyway i want to validate textboxes in edit form.I want to use some regular expression also.How can i do this?
Is there any place to add egular expressions?.Please help me to solve this isssues.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 04 Jan 2013, 05:42 AM
Hi,

Try the following code to achieve your scenario.
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
       if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem item = (GridEditableItem)e.Item;
            TextBox txt = (TextBox)item["Uniquename"].Controls[0];
            RegularExpressionValidator val = new RegularExpressionValidator();
            val.ValidationExpression = ("^[0-9]*$");
            val.ControlToValidate = txt.ID;
            item["Uniquename"].Controls.Add(val);
        }
}

Thanks,
Shinu.
0
Trs
Top achievements
Rank 1
answered on 04 Jan 2013, 05:44 AM
Thank you shinu.It works..
Tags
Grid
Asked by
Trs
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Trs
Top achievements
Rank 1
Share this question
or