Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if statement problem in aspx page

Status
Not open for further replies.

lagc

Programmer
Jan 21, 2009
79
GB
I have an ascx page, but its the same as aspx im told, and i need to wrap an if statement around a piece of html thats looks at the url and thats when the if else statement needs to work, as below:

Code:
<%# if(url=("[URL unfurl="true"]http://www.mysite.com/loginpage.aspx")){[/URL]
<td valign="middle" align="center" style="width: 239px; height: 80px;">
<asp:Image ID="ImageHeaderECristalLogo" ImageAlign="Top" Height="80px" Width="239px" runat="server" ImageUrl="~/Images/eCristalLogo_Large_different.gif" />
</td>
}else{
<td valign="middle" align="center" style="width: 239px; height: 80px;">
<asp:Image ID="ImageHeaderECristalLogo" ImageAlign="Top" Height="80px" Width="239px" runat="server" ImageUrl="~/Images/eCristalLogo_Large.gif" />
%>

Im using Dreamweaver and the colour coded code is not right so i know its not working, but thats backed up by errors that appear.

Can anybody help.

Thanks in advance
 
There is no colored section.

Not sure for this:
The "else" statement opens "{" but not closes it with }
Alse there is no closing </td>
 
You are mixing code with your HTML markup, whick is classic ASP style coding. What you need to do is use the code-behind of your page to place all your code.
You need to just have one <td> in your markup with an image control. Then in your codebehind you can have:
Code:
  If url= "[URL unfurl="true"]http://www.mysite.com/loginpage.aspx"[/URL] Then
   ImagegeHeaderECristalLogo.ImageUrl= "~/Images/eCristalLogo_Large_different.gif
  Else
     ImagegeHeaderECristalLogo.ImageUrl= "~/Images/eCristalLogo_Large.gif
  Endif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top