C# 如何在附加了Id My Code的网页上启用按钮Asp.net?
我正在尝试通过提供其id来启用按钮,就像我在页面上为所有按钮进行了diabling一样,我们如何为具有id的特定按钮执行操作我的代码是C# 如何在附加了Id My Code的网页上启用按钮Asp.net?,c#,asp.net,.net,C#,Asp.net,.net,我正在尝试通过提供其id来启用按钮,就像我在页面上为所有按钮进行了diabling一样,我们如何为具有id的特定按钮执行操作我的代码是 public static void EnableInsertBtn(Control parent) { foreach (Control B in parent.Controls) { if (B.GetType() == typeof(Button)) { ((Button)(B)).
public static void EnableInsertBtn(Control parent)
{
foreach (Control B in parent.Controls)
{
if (B.GetType() == typeof(Button))
{
((Button)(B)).Enabled = false;
}
if (B.HasControls())
{
EnableInsertBtn(B);
}
}
希望你的建议
谢谢尝试使用按钮本身的ID禁用按钮
btnID.Enabled = false;
使能
btnID.Enabled = true;