asp.net
C#
清除控制項
/// <summary>
/// 控制項名稱
/// </summary>
/// <param name="controls"></param>
private void ClearControls(params Control[] controls)
{
foreach (Control control in controls)
{
if (control is TextBox)
{
(control as TextBox).Text = "";
}
else if (control is Label)
{
(control as Label).Text = "";
}
}
}
使用時
ClearControls(TxbTrnPhone,
LabTrnCo,
LabTrnPhone,
LabCodeA, LabCodeB, LabCodeNum
);