如何添加HTML到一个aspx C#codebehind页? [英] How to add html to an aspx C# codebehind page?

查看:123
本文介绍了如何添加HTML到一个aspx C#codebehind页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有机会与ASPX页面的服务器。我需要一个标题,parapgraphs等添加到页面。该网页目前只有以下行:

I have access to a server with aspx pages. I need to add a title, parapgraphs, etc to a page. The page currently only has the following line:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Access.Login" %>

我没有访问到CS文件,只是该DLL。无论如何,当我尝试任何HTML添加到文档中未发生任何变化。我能够改变CSS,如果我删除了继承那么无论HTML我已经被显示,但在继承如果只有被显示的默认页面,没有我的加法。

I do not have access to the CS files, just the DLL. Anyway, when I try to add any html to the document nothing changes. I am able to change the CSS, and if I remove the "inherits" then whatever HTML I have gets displayed, but when the "inherits" is there only the default page gets displayed and none of my additions.

诚然,我是新来的ASP而且我并不想成为一个大师只是一些HTML添加到页面,但任何建议将是巨大的,谢谢!

Admittedly I am new to ASP and moreover I am not trying to become a guru just to add some HTML to a page, but any advice would be great, thanks!

推荐答案

尝试把嵌在.aspx您的Page_Load,并添加控件的方式:

Try putting your Page_Load embedded in the .aspx and add controls that way:

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Access.Login" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e) {
        if (!Page.IsPostBack) {
            Controls.Add(whatever);
        }
    }
</script>

<!-- Try this if the above does not work -->
<script runat="server">
        new protected void Page_Load(object sender, EventArgs e) {
        base.Page_Load(sender, e);
            if (!Page.IsPostBack) {
                Controls.Add(whatever);
            }
        }
</script>

这篇关于如何添加HTML到一个aspx C#codebehind页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆