CurrentPage.Property["tableofcontents"].ToString() is giving value but whenever we try to check null value using this line of code CurrentPage.Property["tableofcontents"]!=null then it always gives null value.why?
Following is code on aspx page:
<div id="spotlight_publications1" >
<ul>
<episerver:PageList PageLinkProperty="PageLink" paging=true PagesPerPagingItem=10 runat="server" ID="publications" >
<ItemTemplate>
<% if (CurrentPage.PageLink.ID==4946)
{%>
<table border="0" width="100%" >
<tr>
<%
try { if(CurrentPage.Property["SpotlightImage"]!=null )
{%>
<td valign=top > <img src='<%# Container.CurrentPage.Property["SpotlightImage"]%>' alt="Image" width=90 height=75 align=left/></td>
<%}
else
{%>
<td valign=top > <img src=../../images/hrsummit.jpg alt="Image" width=90 height=75 align=left/></td>
<%}}
%>
<% catch(Exception ex)
{}
%>
<td >
<table >
<tr>
<td colspan="2">
<div id="red_title">
<episerver:property PropertyName="PageLink" runat="server" ID="Property2" name="Property1"/>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div id="gray_title">
Key Highlights
<!--<img src='../../images/Key-Highlights.jpg' alt="Key Highlights" width=150>-->
</div>
</td>
</tr>
<tr>
<td colspan="2">
<%# Container.CurrentPage.Property["Description"].ToString() %>
</td>
</tr>
<tr>
<td valign=top>
<table>
<tr>
<td>
<div id="gray_title">
Table Of Content
<!--<img src='../../images/Tabel-of-Content.jpg' alt="Tabel of Content" width=150></td>-->
</div>
</td>
</tr>
<tr>
<td><%# Container.CurrentPage.Property["TableofContents"].ToString() %></td>
</tr>
</table>
</td>
<td valign=top>
<table>
<tr>
<td>
<%
i++;
if(i==10)
{%>
<NS:Payment PageLink='<%# Container.CurrentPage %>' visibleline="true" ru1nat=server ID="Price1">
</NS:Payment>
<NS:Price1 PageLink='<%# Container.CurrentPage %>' visibleline="true" runat=server ID="Price13">
</NS:Price1>
<%
}
else
{%>
<NS:Payment PageLink='<%# Container.CurrentPage %>' visibleline="false" r1unat=server ID="Price2">
</NS:Payment>
<NS:Price1 PageLink='<%# Container.CurrentPage %>' visibleline="false" runat=server ID="Price14">
</NS:Price1>
<%
}%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr><td colspan="2"><hr/></td></tr>
</table>
</ItemTemplate>
</ul>
</div>
If you're using it inside the PageList you have to add Container.CurrentPage.Property["tableofcontents"] != null
Btw. - don't think property names are case sensitive.
CurrentPage.Property["propname"] will give you the PropertyData object, not the value.
CurrentPage["propname"] will give you the value, or null if the value is null or the property does not exist on the page.
You're right Steve, just did a test and both Test and test work for ProperyName.
Ajay Singh: how did you solve it?