Larry Brister
asked on
Replace statements HTML with HTML IF
I have html content I am reading in from SQL Server to display on a page.
This content is a basic string HTML
I need the end user to be able to place if then else statements in there
That will show or display particular div tags
Example...
I am getting this from SQL
If dR4.HasRows Then
While dR4.Read()
HTML = dR4("HTML")
HTML = HTML.Replace("[ProspectID] ", dR4("ProspectID"))
HTML = HTML.Replace("[CheckInDate _Dsp]", dR4("CheckinDate")
labelHTML.Text = HTML
End While
End If
So... Can I place the .net logic tags in the string in SQL?
As in
<%
if(condition)
{%>
html code
<% }
else
{
%>
html code
<% } %>
This content is a basic string HTML
I need the end user to be able to place if then else statements in there
That will show or display particular div tags
Example...
I am getting this from SQL
If dR4.HasRows Then
While dR4.Read()
HTML = dR4("HTML")
HTML = HTML.Replace("[ProspectID]
HTML = HTML.Replace("[CheckInDate
labelHTML.Text = HTML
End While
End If
So... Can I place the .net logic tags in the string in SQL?
As in
<%
if(condition)
{%>
html code
<% }
else
{
%>
html code
<% } %>
ASKER
Lets make this simpler...
In the HTML Code I am reading from SQL Server as part of that HTML COntent I have saved this tag
<%=myVar%>
After running the code above...
How do I set a variable code side to display that variable?
In the HTML Code I am reading from SQL Server as part of that HTML COntent I have saved this tag
<%=myVar%>
After running the code above...
How do I set a variable code side to display that variable?
Save anything you like in the db so do you mean compiling the string as code?
http://www.nullskull.com/articles/20030908.asp
http://www.nullskull.com/articles/20030908.asp
ASKER
Maybe I'm just not explaining myself properly.
There is a string from sql server that I am reading and placing into a label.
That string is actually HTML
As part of that string coming in from a SQL Dara Reader is this <%=myVar%>
On the code side... I want to set a public vb variable that <%=myVar%> will display.
There is a string from sql server that I am reading and placing into a label.
That string is actually HTML
As part of that string coming in from a SQL Dara Reader is this <%=myVar%>
On the code side... I want to set a public vb variable that <%=myVar%> will display.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys....sorry for the late getback
you should put your logic when you trying to fill variable: HTML with the values.