Publishing asp.net code to the server...Getting Path Issues via MasterFIle - asp.net

I trying to publish my app from my own PC to the server "C:\Development\MyApp"
Everything works fine on my PC but when I publish the application the server my MasterPage looses all the images for the header... It also has problems with tabs when I click on a tab it tells me that the path is incorrect and that Folder/File does not exist.
Here is my code from the master file I don't see anything out of ordinary that could be causing this issue I hope you do :).
<div id="topContant"
style="background-image: url('/App_Themes/Sugar2006/images/Header.jpg')">
<table cellspacing="0" cellpadding="0" border="0"
style="height: 80px; width: 100%;">
<tr>
<td height="60" rowspan="1">
<img alt="" class="style1"
src="/App_Themes/Sugar2006/images/assisted-living-concepts.gif" />
</td>
<td align="left" valign="top" nowrap class="style2" style="padding-right: 10px;">
<asp:Label ID="WelcomeUser" runat="server" Text="Welcome: " ForeColor="White"></asp:Label>
<br />
<asp:HyperLink ID="lnkMyAccount" Text="My Account"
NavigateUrl="~/Users/MyAccount.aspx" style="color:White" CssClass="myAreaLink"
Runat="server" Font-Size="Small" />
|
<%
if (CPDManagement._code.Security.IS_ADMIN) {
%>
<asp:HyperLink ID="lnkAdmin" Text="Admin"
NavigateUrl="~/Administration/default.aspx" style="color:White"
CssClass="myAreaLink" Runat="server" Font-Size="Small" />
<%
%>
|
<%
}
%>
<asp:HyperLink ID="lnkAbout" Text="About" NavigateUrl="~/Home/About.aspx"
style="color:White" CssClass="myAreaLink" Runat="server" Font-Size="Small" />
<%--<br><%= Application["CONFIG.platform_title"] %>--%>
</td>
</tr>
</table>
</div>
<div id="navcontainer"
style="border-style: outset; border-width: thin; background-color: #663300; height: 30px; ">
<ul id="navlist">
<li runat ="server" id="Home"> <a id="current" href="/Home/Home.aspx" title="Home"><span>Home</span></a></li>
<%--<li runat ="server" id="Tab2"> <span>Tab 2</span></li>--%>
</ul>
</div>
<div>
The its failing to display "App_Themes" and also fails to reference to href="/Home/Home.aspx" when clicked on the Home button.
I have tried placing a "~" before the "/" or removing the "~" and "/" and nothing.
Any ideas?

In case you need to resolve path in non-server tags, use ResolveUrl:
<li runat ="server" id="Home"> <a id="current" href='<%= ResolveUrl("~/Home/Home.aspx") %>' title="Home"><span>Home</span></a></li>
Also, if you use theming, for images consider using SkinId with asp:Image. For background images, move declarations to css under theme folder.

Related

using inline content in jquery thickbox

I use JQuery ThickBox 3.1 , and here is my code
<telerik:RadListView runat="server" ID="myDataList" AllowPaging="true"
DataKeyNames="id" ItemPlaceholderID="PlaceHolder1"
NeedDataSource="list_DataRebind">
<LayoutTemplate>
<div class="sushibar">
<asp:Panel ID="SushiPanel" runat="server">
<div class="sushi">
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</div>
<telerik:RadDataPager ID="RadDataPager1" runat="server" PageSize="4" PagedControlID="myDataList">
<Fields>
<telerik:RadDataPagerButtonField />
<telerik:RadDataPagerPageSizeField />
<telerik:RadDataPagerSliderField />
</Fields>
</telerik:RadDataPager>
</asp:Panel>
</div>
</LayoutTemplate>
<ItemTemplate>
<div class="imageDiv">
<span style="margin-bottom: 5px; display: block; color: #FF6600; font-weight: bold;">
<%#Eval("Title") %></span>
<br />
<a href='<%#Eval("ImagePath")%>' title='<%#Eval("Title")%>' class="thickbox" >
<img src='<%#Eval("ImagePath")%>' alt="Single Image" width="150px" height="200px" /></a></div>
</ItemTemplate>
</telerik:RadListView>
Popup box with Image and Title show correctly , but I have another field(<%#Eval("Description")%>) to show with it !
I found how to show Inline Content in Thickbox ,
<input alt="#TB_inline?height=300&width=400&inlineId=myOnPageContent" title="add a
caption to title attribute / or leave blank" class="thickbox" type="button" value="Show" />
<a href="#TB_inline?height=155&width=300&inlineId=hiddenModalContent&modal=true"
class="thickbox">Show hidden modal content.</a>
But I don't know how to use this in a ListView !
:D , I found the answer ! Just put the contents ( Image + Description ) to hidden division (style with Display:none) and set this div id to inlineId .
<ItemTemplate>
<div class="imageDiv">
<span style="margin-bottom: 5px; display: block; color: #FF6600; font-weight: bold;">
<%#Eval("Title") %></span>
<br />
<div id="popUpRegion" style="display: none">
<img src='<%#Eval("ImagePath")%>' alt="Single Image" width="500px" height="600px" />
<p>
<%#Eval("Description")%></p>
</div>
<a href="#TB_inline?height=800&width=600&inlineId=popUpRegion" title='<%#Eval("Title")%>'
class="thickbox">
<img src='<%#Eval("ImagePath")%>' alt="Single Image" width="150px" height="200px" /></a></div>
</ItemTemplate>

ASP.Net Printer Friendly Page

Morning All,
I am trying to make a web page printer friendly. I have managed to complete this for one of my pages perfectly fine by having another style sheet and the referencing this is my master page.
<link href="Styles/style2.css" rel="stylesheet" type="text/css" />
<link href="styles/style-print.css" media="print" rel="stylesheet" type="text/css" />
The problem that i have is the main page i wish to have a printer friendly option hold is made up of ASP. Panel controls and these also have 1 or 2 subpanels. I used these panels to reduce clutter and scrolling.
If i add the relevant div tags to the main page i seem to only get the headers of these Panels and do not get the sub headings or and the content within these panels unless i collapse these panels before i click the printer friendly button.
This is not a task that i wish the user to complete also the printer friendly page looks horrible as i would like to remove the panel / boxes. Is there a way for me to format this page so i dont get to see the panels but just the content when the users presses the pinter friendly button?
Regards
Betty.
Here is some sample code for my collopsible panels...
<table>
<tr>
<td style="width:528px">
<h5>Topic</h5>
</td>
<td style="width:154px">
<h5>Presenter</h5>
</td>
<td>
<h5>Time</h5>
</td>
</tr>
</table>
<!-- 1. HSE Issues (Main heading) -->
<asp:Panel ID="pnlHeaderHSERegIssues" runat="server" CssClass="pnl"
Width="740px">
<div style="float:left;">
1. Safety, Health, Environmental & Regulatory Issues
</div>
<div style="float:right;">
<asp:Label ID="lblShowHideHSERegIssues" runat="server"></asp:Label>
</div>
<div style="clear:both">
</div>
</asp:Panel>
<!-- 1.1 Safety Sub heading -->
<asp:Panel ID="pnlInfoHSERegIssues" runat="server" CssClass="pnlBody">
<asp:Panel ID="pnlHeaderSafety" runat="server" CssClass="pnlBody2" Width="740px">
<div style="float:left;">
1.1 - Safety Reviews
</div>
<div style="float:right;">
<asp:Label ID="lblShowHideSafety" runat="server"></asp:Label>
</div>
<div style="clear:both">
</div>
</asp:Panel>
<asp:Panel ID="pnlInfoSafety" runat="server" CssClass="pnlBody">
<table width="100%">
<tr>
<td style="width: 510px">
<asp:TextBox ID="txtSafety" runat="server" Height="100px"
style="font-family:Verdana" TextMode="MultiLine" Width="510px"></asp:TextBox>
</td>
<td style="width: 140px" valign="top">
<asp:TextBox ID="txtSafetyPresenter" runat="server" Height="97px"
style="font-family:Verdana" width="140px"></asp:TextBox>
</td>
<td style="width: 57px" valign="top">
<asp:TextBox ID="txtSafetyTime" runat="server" style="font-family:Verdana"
width="50px"></asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
<!-- Collapse / un-collapse Panels (Main Heading) -->
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender" runat="server"
CollapseControlID="pnlHeaderHSERegIssues" Collapsed="true"
CollapsedText="Show Details" ExpandControlID="pnlHeaderHSERegIssues"
ExpandDirection="Vertical" ExpandedText="Hide Details" ScrollContents="false"
TargetControlID="pnlInfoHSERegIssues" TextLabelID="lblShowHideHSERegIssues">
</asp:CollapsiblePanelExtender>
<!-- Collapse / un-collapse Panels (sub Heading) -->
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server"
CollapseControlID="pnlHeaderSafety" Collapsed="true" CollapsedText="Show"
ExpandControlID="pnlHeaderSafety" ExpandDirection="Vertical" ExpandedText="Hide"
ScrollContents="false" TargetControlID="pnlInfoSafety"
TextLabelID="lblShowHideSafety">
</asp:CollapsiblePanelExtender>

HTML Editor inside Ajax Collapsible Panel Extender not being displayed in IE 6 for asp.net web page

I have a Ajax HTMLEditor in my web page inside a panel which is targeted by the collapsible panel extender.
When the panel is expanded, there is a big empty space without any of the controls inside the panel being displayed.
The issue here is the panel is expanded but there is nothing visible inside it including any buttons and the Html editor. When i scroll up and down though the controls sometimes become visible.
<cc1:CollapsiblePanelExtender ID="ColPnlExtEvents" runat="server" TargetControlID="pnlAddContentEvents"
BehaviorID="ColPnlExtEventsBehavior" TextLabelID="lblShowEvents" SuppressPostBack="true"
CollapsedImage="~/images/expand.jpg" ExpandedImage="~/images/collapse.jpg" CollapsedText="(Show Details...)"
ExpandedText="(Hide Details...)" ImageControlID="ImgBtnEvents" Collapsed="True" CollapsedSize="1"
CollapseControlID="pnlEvents" ExpandControlID="pnlEvents">
</cc1:CollapsiblePanelExtender>
<asp:Panel Style="cursor: pointer" ID="pnlEvents" runat="server" CssClass="collHeader">
<div style="padding: 2px; cursor: pointer; vertical-align: middle;">
<div style="float: left;">
<asp:Label ID="abnormalEventsLabel" runat="server">Add Abnormal Events</asp:Label></div>
<div style="float: left; margin-left: 20px;">
<asp:Label ID="lblShowEvents" runat="server">(Show Details...)</asp:Label>
</div>
<div style="float: right; vertical-align: middle;">
<asp:ImageButton ID="ImgBtnEvents" runat="server" ImageUrl="~/images/expand.jpg"
AlternateText="(Show Details...)" />
</div>
</div>
</asp:Panel>
<asp:Panel Style="overflow: hidden" ID="pnlAddContentEvents" runat="server" CssClass="collPanel"
Height="0px">
<table id="tblEventsDetails" width="100%" runat="server">
<tr>
<td align="left">
<a class="labelText">Description</a>
</td>
<td style="width: 75%">
<uc:RichTextBox ID="abnormalEventsDescriptionRichTextBox" runat="server" />
</td>
</tr>
<tr>
<td class="blankRow">
</td>
</tr>
<tr>
<td colspan="2" align="right">
<asp:LinkButton CssClass="btnSimpleSave" ID="abnormalEventSaveLinkButton" runat="server"
OnClick="abnormalEventSaveLinkButton_Click" OnClientClick="javascript:return ParticularClosureRichTextBoxValidation('ctl00_cphMain_abnormalEventsDescriptionRichTextBox_HTMLText','Abnormal Events');">Save</asp:LinkButton>
<asp:LinkButton CssClass="btnSimpleCancelForSubSections" ID="abnormalEventCancelLinkButton"
runat="server" CausesValidation="false" OnClick="abnormalEventCancelLinkButton_Click">Cancel</asp:LinkButton>
</td>
</tr>
</table>
</asp:Panel>
Many times, different JS libraries does not mix well today - you might have encountered the same.
Personally, I prefer pure js based approaches (such as jquery or jquery plugin) over control based approaches (as done in Ajax Control Toolkit). For collapsible panel, you can use jquery sliding functions. For example, see this fiddle that I had put up for another SO question to illustrate multiple collapsible panels

cannot toggle visibility of usercontrol in side td

I have a usercontrol which I inset in to the page with the following code:
<table id="MainFrame" runat="server" style="border-style: solid; border-width: 0px 3px 3px 3px;table-layout :fixed; width :562px; text-align :center; background-color :White;" cellpadding ="0" cellspacing ="0">
<tr>
<td style="width:5px;"><div style="width:5px;height:10px"></div></td>
<td>
<div runat="server" id="divTextLink" style="padding-top: 10px;">
<Ligdol:TextLink ID="TextLink1" runat="server" Visible="False" />
</div>
</td>
</tr>
In the code-behind I have an if statment which sets the visibility to true.
I put a breakpoint on the line and it's hit, but the visibility does not change.
I tried adding to the td, but that doesn't help either.
If I put the control outside of the table, everything works as it should.
Edit: The usercontrol code
<%# Control Language="C#" AutoEventWireup="true" CodeFile="TextLinks.ascx.cs" Inherits="NewChannels_Controls_TextLinks" %>
<img style="float: right;" src="/Ligdol/Upload/textlinks.png" />
<asp:HyperLink runat="server" ID="txtLink"></asp:HyperLink>
Change this
<td>
<div runat="server" id="divTextLink" style="padding-top: 10px;">
<Ligdol:TextLink ID="TextLink1" runat="server" Visible="False" />
</div>
</td>
to this
<td style="padding-top: 10px;">
<Ligdol:TextLink ID="TextLink1" runat="server" Visible="False" />
</td>
I can't see no other reason to this not work.

Ajax CollapsiblePanel not working in IE 8 for compatibility mode

I am using an ajax collapsiblepanel extender in a webapp (asp.net) designed for IE 6. Currently for making the application compatible with IE 8 i have added a metatag - .
Everything in the application works fine except the collapsible panels using the ajax control.
These panels are always expanded.
Any idea on how to ensure the panels collapse and expand as expected in IE 8.
Note - i have tried changing the css class for collPanel where overflow:hidden is present to display:none but this kept the panel only collapsed.
Code snippet:
<cc1:CollapsiblePanelExtender ID="ColPnlExtAddUser" runat="server" TargetControlID="pnlAddContentUser"
ExpandControlID="pnlAddHeaderUser" CollapseControlID="pnlAddHeaderUser" Collapsed="True"
ImageControlID="ImgBtnAddUser" ExpandedText="(Hide Details...)" CollapsedText="(Show Details...)"
ExpandedImage="~/images/collapse.jpg" CollapsedImage="~/images/expand.jpg" SuppressPostBack="true"
TextLabelID="lblShowUser" BehaviorID="ColPnlExtAddUserBehavior">
</cc1:CollapsiblePanelExtender>
<asp:Panel Style="cursor: pointer" ID="pnlAddHeaderUser" runat="server" CssClass="collHeader">
<div style="padding: 2px; cursor: pointer; vertical-align: middle;">
<div id="Div2" style="float: left;">
<asp:Label ID="labelUserManagement" runat="server" Text="Add User"></asp:Label>
</div>
<div style="float: left; margin-left: 20px;">
<asp:Label ID="lblShowUser" runat="server">(Show Details...)</asp:Label>
</div>
<div style="float: right; vertical-align: middle;">
<asp:ImageButton ID="ImgBtnAddUser" runat="server" ImageUrl="~/images/expand.jpg"
AlternateText="(Show Details...)" />
</div>
</div>
</asp:Panel>
<asp:Panel Style="overflow: hidden" ID="pnlAddContentUser" runat="server" CssClass="collPanel"
Height="0px">
<table id="tblAddUserDetails" width="100%" runat="server">
<tbody>
<tr>
<td align="left">
<a class="labelText">First Name</a>
</td>
<td>
<asp:TextBox ID="firstNameTextbox" runat="Server" MaxLength="20" Width = "48%"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left">
<a class="labelText">Last Name</a>
</td>
<td >
<asp:TextBox ID="lastNameTextbox" runat="Server" MaxLength="20" Width = "48%"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:LinkButton ID="saveUserLinkButton" runat="server" CssClass="btnSimpleSave" OnClick="saveUserLinkButton_Click" >Save</asp:LinkButton>
</td>
</tr>
</tbody>
</table>
</asp:Panel>
ya sometime it support by some version of IE, i suggest you to use Jquery, it is easy and powerful.

Resources