下面是我的Default.aspx的内容
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
WELCOME
</h2>
<p id="exampleId">
I want to edit here
</p>
</asp:Content>我希望能够找到ID为"exampleID“的控件,并使用c#将一些内容写入其中。
发布于 2012-02-27 21:26:46
runat = "server“在标记中缺失,无法从代码后台访问它。
HTML
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
WELCOME
</h2>
<p id="exampleId" runat = "server">
I want to edit here
</p>
</asp:Content>C#代码
exampleId.InnerText = "Your text";发布于 2012-02-27 21:40:43
您在这里有几个选项:
中添加服务器端控件“文本”
希望能有所帮助。
https://stackoverflow.com/questions/9465731
复制相似问题