有没有办法使用 C# 脚本来更改标签的内部 html?
我需要将标签的内容从“购物车”更改为“下载”。通常这只是通过手动更改 html 来完成,但我无权访问它。相反,我可以访问在服务器上运行的 C# 脚本的一小部分。有没有办法通过 C# 脚本更改标签的内容?
编辑
好的,这是我必须更改的代码
<a id="ctl00_ctl00_PageHeader1_shoppingCart_anchor" class="navBarButton"
href="javascript:__doPostBack('ctl00$ctl00$PageHeader1$shoppingCart$anchor','')">
Shopping Cart</a>
,这是脚本标头的内容,
<script language="C#" runat="server">
希望这能提供更多上下文,我真的只需要知道它是否可能,所以任何帮助都会很棒
I need to change the contents of an tag from "Shopping Cart" to "Downloads". Normally this would just be done by changing the html by hand but i don't have access to that. Instead i have access to a small snip of a C# script that runs at the server. Is there anyway to change the contents of the tag through a C# script?
EDIT
Okay here is the code i have to change
<a id="ctl00_ctl00_PageHeader1_shoppingCart_anchor" class="navBarButton"
href="javascript:__doPostBack('ctl00$ctl00$PageHeader1$shoppingCart$anchor','')">
Shopping Cart</a>
And here is what the script header has
<script language="C#" runat="server">
Hopefully this gives some more context, i really just need to know if its possible or not so any help at all would be great
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
与其他答案一样,这取决于服务器端代码实际提供的内容。
您也许能够输出一些 javascript 来定位有问题的控件,并重置其内容,可能使用类似这样的内容...
但是,在不知道 HTML 是什么的情况下,我无法为您提供更多帮助。
As with other answers, this will depend on what the server side code is actually providing.
You might be able to output some javascript to locate the control in question, and reset its contents, possibly with something like this...
Without seeing what the HTML is, though, I can't help you much more than that.
您可以使用控件代替标准 HTML,并在需要时更改其内容;
并在 code_behind 中
You could use an control in place of the standard HTML and change the contents of this as and when required;
and in code_behind