|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
namespace AjaxValidatorCallouts.UserControls
{
public partial class CustomTextBox : System.Web.UI.UserControl
{
/// <summary>
/// Setting validation group for validator
/// </summary>
public string ValidationGroup
{
set
{
RequiredFieldValidator.ValidationGroup = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// To Set ajax callout for validators by using validators ID
/// </summary>
private void CreateAjaxCallout(string controlID, string validatorClientID)
{
ValidatorCalloutExtender valExtender = new ValidatorCalloutExtender();
valExtender.TargetControlID = controlID;
valExtender.BehaviorID = "AjaxCallouts_" + validatorClientID;
valExtender.ID = controlID + "_ValExtender";
valExtender.HighlightCssClass = "validatorCalloutHighlight";
valExtender.Width = new Unit(250);
validatorPlaceHolder.Controls.Add(valExtender);
}
/// <summary>
/// Call when prerendering the validator
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void RequiredFieldValidator_PreRender(object sender, EventArgs e)
{
CreateAjaxCallout(RequiredFieldValidator.ID, RequiredFieldValidator.ClientID);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am working for Proteans Software Solutions since 3.5 years. Proteans is a leading Outsourced Product Development Company. We partner with ISVs, SaaS companies, Internet businesses & software R&D organizations of Fortune 1000 companies and provide them complete software lifecycle services from software product engineering, sustenance, pre-sales support, professional services and technical support.