0
我有一个包含iframe,一个ASP标签和一个按钮的父页面。 当用户点击父按钮时,它会在iframe中显示一些表结果。 现在我想根据iframe的结果显示具有不同文本和颜色的父标签。 所以我尝试在代码背后(C#)的iframe从父级检索标签,并为其分配一个CssClass。但是,无论我做什么,当试图从父项中找到控件时总会返回空引用。 有人可以帮忙吗?C#从父页面访问asp控件
父页面代码:
<div class="search-row">
<div class="search">
<button id="btnSearch" type="submit" class="button button-block">Search</button>
</div>
<div class="search" style="padding-top: 20px;">
<asp:Label ID="wrapperResponse" CssClass="resp" runat="server">TEST</asp:Label>
</div>
</div>
<div id="iframeDiv">
<iframe name="my_frame" width="100%" height="350px" src="Results.aspx" scrolling="no" frameborder="0"></iframe>
</div>`
的Results.aspx将显示一些HTML动态生成的表。 现在让我们说如果结果表有一行,我想标签WrapperReponse在绿色,并说“1行”,但如果2行,那么我希望它在红色,并说“2行”
在我的结果.aspx.cs我试过
String test= String.Format("{0}", Request.Form["wrapperResponse"]);
Label statusResponse = (Label)this.FindControl("wrapperResponse");
Label statusResponse2 = (Label)Parent.FindControl("wrapperResponse");
任何想法,欢迎! 谢谢