设置页面中的所有控件的某属性的方法(2)
Binder binder = null;
object[] args = null;
object result = type.InvokeMember(propertyName, flags, binder, control, args);
return Convert.ToString(result);
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
GridView1.DataSource = new String[] { "A", "B" };
GridView1.DataBind();
}
}
</script>
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="MengXianhuiForm" runat="server">
<asp:TextBox ID="TextBox1" runat="server" Text="能输入文字吗"></asp:TextBox>
<asp:ListBox ID="ListBox1" runat="server">
<asp:ListItem>AA</asp:ListItem>
<asp:ListItem>BB</asp:ListItem>
</asp:ListBox>
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="x" runat="server" Text="测试" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="设置页面中的所有控件的 Enabled 属性" />
</form>
</body>
</html>
相关新闻>>
- 发表评论
-
- 最新评论 更多>>