在asp.net中找到html控件
问题描述:
<li id="liInvoiceYetToBeRaisedReport" runat="server" visible="false"><ahref style="background: removed(Images/strip.png) repeat-y;">
我在母版页中有此标签
现在我想找到"liInvoiceYetToBeRaisedReport".
我尝试使用此代码进行查找,但没有成功
i have this tags in masterpage
now i want to find "liInvoiceYetToBeRaisedReport".
i tried this code for finding but it didn''t work
HtmlGenericControl lt = (HtmlGenericControl)Master.FindControl("liInvoiceYetToBeRaisedReport");
请给我一个解决方案.
kindly give me a solution.
答
您不需要查找控件
您将使用id直接在aspx.cs页面中访问此控件
you don''t need to find control
you will directly access this control in aspx.cs page using id
请参阅以下CP文章中的如何与内容页面中的母版页控件进行交互"部分,
内部母版页 [
Refer to the section "How to interact with master page controls from content page" in the below CP article,
Inside Master Pages[^]
Hope it helps.