<li id="Adduser"><a href="AddAgent.aspx">Add User</a></li>
这个html代码在母版页中。我希望在我的id="Adduser"
中使用此t=# PREPARE get_account (varchar) AS SELECT * FROM pg_tables where tablename = $1;
PREPARE
t=# execute get_account ('pg_statistic');
schemaname | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers
------------+--------------+------------+------------+------------+----------+-------------
pg_catalog | pg_statistic | postgres | | t | f | f
(1 row)
与该母版页链接的内容页面。我怎么能这样做?
答案 0 :(得分:0)
首先,在
<li id="Adduser" runat="server" > <a href="AddAgent.aspx">Add User</a></li>
然后
ContentPlaceHolder mpContentPlaceHolder;
HtmlGenericControl MyliTag ; // Use using System.Web.UI.HtmlControls;
mpContentPlaceHolder = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
MyliTag = ( HtmlGenericControl) mpContentPlaceHolder.FindControl("Adduser");
现在您可以更改属性
答案 1 :(得分:0)
您需要添加runat="server"
,然后您可以使用FindControl
找到该控件。
<li id="Adduser" runat="server"><a href="AddAgent.aspx">Add User</a></li>
aspx页面上的代码
HtmlGenericControl li = Master.FindControl("Adduser") as HtmlGenericControl;
li.InnerHtml = "<a href=\"EditAgent.aspx\">Edit User</a>";