Sunday, July 5, 2009

Change ValidationGroup on Wizard Buttons

To change the validation group programatically on the Wizard Control button you can loop through find all buttons and assign the validation group property. See below.



public void AssignValidationGroup(Control ctrl)
{
foreach (Control c in ctrl.Controls)
{
string i = c.GetType().ToString();
if (c.GetType().ToString() == "System.Web.UI.WebControls.Button")
{
((Button)c).ValidationGroup = "osMemberControlsValidate";
}
if (c.Controls.Count > 0)
{
foreach (Control cc in c.Controls)
{
AssignValidationGroup(cc);
}
}
}
}

No comments: