简体   繁体   中英

how can i add h3 code from asp.net behind code?

I want show a html code from "else", how can i?

this is my code

    if (output == "1")
    {

        Session["user"] = textuser.Text;
        Response.Redirect("~/Default2.aspx");
    }
    else
    {


        // show html code <h4  id='error1' runat ='server'></h4>
    }

You could add that control to the page, but with Visible=false

<h4 id="error1" runat="server" Visible="false"></h4>

And then you can just set make it visible from the code beside:

error1.Visible = true;
error1.InnerText = "Some message";

有很多方法可以使猫皮化,但是一种方法是将HtmlGenericControl添加到WebForm中,然后将适当的标记(“ h3”或“ h4”)传递给构造函数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM