class BasePage:Page
{
public static void SetInputControlsHighlight(Control container
{
foreach (Control ctl in container
{
if ((onlyTextBoxes && ctl is TextBox) ctl is TextBox ctl is DropDownList
ctl is ListBox ctl is CheckBox ctl is RadioButton
ctl is RadioButtonList ctl is CheckBoxList)
{
WebControl wctl = ctl as WebControl;
wctl
wctl
}
else
{
if (ctl
SetInputControlsHighlight(ctl
}
}
}
}
定義一個類
這裡需要注意
WebForm
{
//調用SetInputControlsHighlight方法
}
這樣就可以了
From:http://tw.wingwit.com/Article/program/net/201311/13893.html