elliottbenzle
asked on
how to output text in asp.net vb
Hi,
I'm learning asp.net VB and am having troble with what should be a simple problem. I just want to output a string but am having a difficult time figuring out how to do so. I have an asp classic page which just assigns a text string to a variable and then writes the value.
<%
imgop = "<html><body><script type=""text/javascript"">w indow.pare nt.CKEDITO R.tools.ca llFunction ('1','/sen ate/leg.ti tle.jpg'); </script>< /body></ht ml>;"
Response.write imgop
%>
Seems simple but I can't seem to find how to make a variable in asp.net or assign it a value or write the contents. Could someone show me how to do this simple thing? Thanks.
I'm learning asp.net VB and am having troble with what should be a simple problem. I just want to output a string but am having a difficult time figuring out how to do so. I have an asp classic page which just assigns a text string to a variable and then writes the value.
<%
imgop = "<html><body><script type=""text/javascript"">w
Response.write imgop
%>
Seems simple but I can't seem to find how to make a variable in asp.net or assign it a value or write the contents. Could someone show me how to do this simple thing? Thanks.
in your html just do this
<asp:label runat="server" id="label1" />
Now when in your code you say
label1.text="Whatever you want to say"
The line "Whatever you want to say" will show up wherever the asp:Label control is on the page
Source: https://www.experts-exchange.com/questions/21140575/Display-variable-on-asp-net-page.html
<asp:label runat="server" id="label1" />
Now when in your code you say
label1.text="Whatever you want to say"
The line "Whatever you want to say" will show up wherever the asp:Label control is on the page
Source: https://www.experts-exchange.com/questions/21140575/Display-variable-on-asp-net-page.html
ASKER
It's not quite the same. If I use an asp: label the output is wrapped in a <span> tag. Like this:
<span id="label1"><html><body><s cript type="text/javascript">win dow.parent .CKEDITOR. tools.call Function(' 1','admin_ images/ell iott.jpg') ;</script> </body></h tml>;</spa n>
I need the results to look like this:
<html><body><script type="text/javascript">win dow.parent .CKEDITOR. tools.call Function(' 1','admin_ images/ell iott.jpg') ;</script> </body></h tml>;
Is there a way to have this code make the same output but without the <span> tag?
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<% label1.text="<html><body>< script type=""text/javascript"">w indow.pare nt.CKEDITO R.tools.ca llFunction ('1','admi n_images/e lliott.jpg ');</scrip t></body>< /html>;" %>
<asp:label runat="server" id="label1" />
<span id="label1"><html><body><s
I need the results to look like this:
<html><body><script type="text/javascript">win
Is there a way to have this code make the same output but without the <span> tag?
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<% label1.text="<html><body><
<asp:label runat="server" id="label1" />
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, that did it. Thanks.
>> Try using the Literal control and in your code behind say: Literal1.text = "your data"
That's what I also said in the first comment !
That's what I also said in the first comment !
If you define a public variable in the code-behind, you can use it with Response.write in the HTML
html:
<div><%=YourString%></div>
code:
Partial Class yourpage
Inherits System.Web.UI.Page
Public YourString As String = "test"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
YourString = "pageloaded"
End Sub
End Class
can you use the literal control . use into code behind
put like that Literal1.text="Image edit"
put like that Literal1.text="Image edit"
Open in new window