When I assigned validation using RadInput inside a grid dynamically, it changes the size and remove the rounded corners of the textboxes. please see attach image (look on Customer, WebSite and Profile Link field)
Here's the code:
protected void grdCustomer_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) |
{ |
if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
{ |
string strURL = @"^(http\:\/\/|[a-zA-Z0-9_\-]+(?:\.[a-zA-Z0-9_\-]+)*\.[a-zA-Z]{2,4}(?:\/[a-zA-Z0-9_]+)*(?:\/[a-zA-Z0-9_]+\.[a-zA-Z]{2,4}(?:\?[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)?)?(?:\&[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)*)$"; |
GridEditableItem item = e.Item as GridEditableItem; |
TextBox txtName = (TextBox)item["CustomerName"].Controls[0]; |
TextBox txtProfile = (TextBox)item["ProfileLink"].Controls[0]; |
TextBox txtWebsite = (TextBox)item["Website"].Controls[0]; |
TextBoxSetting riReq = (TextBoxSetting)riManager.GetSettingByBehaviorID("riReq"); |
riReq.ErrorMessage = "Required field"; |
riReq.TargetControls.Add(new TargetInput(txtName.UniqueID, true)); |
RegExpTextBoxSetting riURL = (RegExpTextBoxSetting)riManager.GetSettingByBehaviorID("riURL"); |
riURL.ErrorMessage = "Invalid URL"; |
riURL.ValidationExpression = strURL; |
riURL.TargetControls.Add(new TargetInput(txtProfile.UniqueID, true)); |
riURL.TargetControls.Add(new TargetInput(txtWebsite.UniqueID, true)); |
} |
} |