I need that some html in the area in the asp.net page that i am coding, is changed according to a string variable. I was thinking about creating a label, and then change the text on it.
But the string variable contains something like:
<h2><p>Notify:</p> alert</h2>
So, I don't feel that give this to a label text is a good idea
How i can do? Using response.write? If I use response.write, my added code will be at the beginning of the html source, how i can tell him to add it in a specific ?
Thank you
The ASP Write() method is used to display a string as an output on the webpage. It is a predefined method of the Response and Textstream type object. Parameter Values: This method contains the value i.e variant which represents the specified string that you want to display as an Output.
Content = "text/html; charset=utf-8"; head. Controls. Add(contentType); HtmlGenericControl title = new HtmlGenericControl("title"); title. InnerText = "Untitled Document"; head.
If you are already familiar with client-side scripting, you are aware that the HTML <SCRIPT> tag is used to enclose script commands and expressions. You can also use the <SCRIPT> tag for server-side scripting, whenever you need to define procedures in multiple languages within an . asp file.
If you really don't want to use any server controls, you should put the Response.Write
in the place you want the string to be written:
<body> <% Response.Write(stringVariable); %> </body>
A shorthand for this syntax is:
<body> <%= stringVariable %> </body>
why don't you give LiteralControl a try?
myLitCtrl.Text="<h2><p>Notify:</p> Alert</h2>";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With