Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

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
<% } %>
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

what "condition" do you mean here?

you should put your logic when you trying to fill variable: HTML with the values.
Avatar of Larry Brister

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?
Avatar of Nicholas
Nicholas

Save anything you like in the db so do you mean compiling the string as code?

http://www.nullskull.com/articles/20030908.asp
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.
SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks guys....sorry for the late getback