foreach (Control obj in this.Controls[1].Controls)
{
if (obj is System.Web.UI.WebControls.Button)
{
Response.Write(((Button)obj).Text);
}
}try it.
{
if (obj is System.Web.UI.WebControls.Button)
{
Response.Write(((Button)obj).Text);
}
}try it.
解决方案 »
- 高分求解Cookie的能够保存的最大长度、长度的计算方法。
- 问个递归的问题
- 兄弟跪求,快挂了,ASP.NET2.0 如何在一个页面中,反射获取另一个页面类呢?分不多,全给了
- 很苦恼的网页速度!!!大吓帮忙(在线等)
- 这种产品对比要如何做?
- jquery uploadify 插件上传图片问题
- 【讨论】业务逻辑层到底用来干嘛的?
- 怎么用IFRAME或者是FRAME实现左边是导航菜单 右面是具体的内容 请贴出源码 谢谢
- ASP.NET,分布式计算,网络服务(WEB SERVICES),网络应用编程这一大堆东西就竟有什么内在的联系?
- MVC中断点调试问题,和view页面路径访问问题
- 为什么在Datagrid中,当只有一行或两行的时候,每行的高度都很大,我应该怎么做。
- 不使用js,如何弹出一个定制页面
谢谢你,但好像还是没用阿
你的代码没有输出
可以通过递归来遍历:
private void GetSubControl(Control obj)
{
foreach (Control c in obj.Controls)
{
if (c is Button)
{
Response.Write(((Button)c).ID + "<br>");
}
if (c.Controls.Count > 0)
{
this.GetSubControl(c);
}
}
}
调用:
this.GetSubControl(this);不知道这个方法是不是有点笨。
<table id="Table6" width="984" runat="server">
<tr id="Tr8" runat="server">
<td align="left" runat="server" ID="Td19">
<INPUT type="button" value="閉じる" onclick="javascript:self.close()"><A onclick="javascript:window.history.back();" href="#">戻る</A>
</td>
<td id="Td21" runat="server" align="right">
<asp:button id="Button5" runat="server" Width="119px" Text="品目アラーム明細"></asp:button>
<asp:button id="Button6" runat="server" Width="121px" Text="欠品アラーム明細"></asp:button>
<asp:button id="Button4" runat="server" Width="135px" Text="使用先アラーム明細"></asp:button>
<asp:button id="Button7" runat="server" Width="125px" Text="使用先別余剰在庫 "></asp:button>
</td>
</tr>
</table>
</form>应该没有包含在form中
谢谢 icyer() ,again
你完全可以为这些button写一个css style。