How to hide controls when blank in a Layout Page?<p align=left><font face=Arial size=2>Hi All,</font></p> <p align=left> </p> <p>I want to hide a field (image in this case but could be any field) in a Page Layout when it is blank. This field is inside a table td tag</p> <p align=left> </p> <p align=left>i.e.</p> <p align=left> </p> <p align=left><font color="#000080">&lt;PublishingWebControls:EditModePanel PageDisplayMode=&quot;Display&quot; runat=&quot;server&quot; Wrap=&quot;false&quot; ID=&quot;disp&quot; Width=&quot;734px&quot;&gt;</font></p> <p align=left><font color="#000080"></font> </p> <p align=left><font color="#ff0000">&lt;what could be the tag here to display this conditionally i.e. only if user selected a image it should display&gt;</font></p> <p align=left><font color="#000080">    &lt;tr&gt;<br>           &lt;td&gt;<br>                    &lt;PublishingWebControls:RichImageField FieldName=&quot;PublishingRollupImage&quot; runat=&quot;server&quot;&gt;<br>                   &lt;/PublishingWebControls:RichImageField&gt;</font></p> <p><font color="#000080"></font> </p> <p align=left><font color="#000080">           &lt;/td&gt;</font></p> <p align=left><font color="#000080">    &lt;/tr&gt;</font></p> <p align=left><font color="#000080"></font> </p> <p align=left><font color="#000080"><font color="#ff0000">&lt;/end of condition&gt;</font></p> <p align=left> </p> <p align=left>&lt;/PublishingWebControls:EditModePanel&gt; </p> <p align=left> </p> <p align=left><strong>a)</strong> One way: Use &lt;WebPartPages<img alt="Big Smile" src="http://forums.microsoft.com/MSDN/emoticons/emotion-2.gif">ataFormWebPart ... &gt; </p> <p align=left>&lt;WebPartPages<img alt="Tongue Tied" src="http://forums.microsoft.com/MSDN/emoticons/emotion-7.gif">PDataSource DataSourceMode=&quot;ListItem&quot; ID=&quot;ds1&quot;  SelectCommand=&quot;&quot;&gt;<br></p> <blockquote dir=ltr style="margin-right:0px"> <p align=left>     &lt;SelectParameters&gt;<br>                       <font color="#ff0000">&lt;SharePointWebControls<img height=19 alt="Big Smile" src="http://forums.microsoft.com/MSDN/emoticons/emotion-2.gif" width=19>ataFormParameter ..... ??? what to pass here ??? &gt;<br></font>     <br>     &lt;/SelectParameters&gt;<br>    <br>    &lt;/WebPartPages<img height=19 alt="Tongue Tied" src="http://forums.microsoft.com/MSDN/emoticons/emotion-7.gif" width=19>PDataSource&gt;  <br></p></blockquote> <p align=left>i.e. <font color="#ff0000">how to refer to the current list Item in the DataFormWebPart ? </font></p> <p align=left><font color="#ff0000"></font> </p> <p align=left><strong>b)</strong>  Other way I can think of is to create a custom control inherited from asp<img alt="Stick out tongue" src="http://forums.microsoft.com/MSDN/emoticons/emotion-4.gif">laceholder, override the visible property, create a new property as controlsToCheck=&quot;ctrl1&quot; and check the value of this control &quot;ctrl1&quot; and if it is blank set the visible property to false otherwise true. </p> <p align=left>(I have not developed this this but probably it should work)</p> <p align=left> </p> <p align=left>On the pagelayout use the controls the following way:</p> <p align=left> </p> <p align=left>&lt;MyConditionalPlaceHolder  .... ControlToCheck=&quot;Ctrl1&quot; ....&gt;</p> <p align=left> </p> <blockquote dir=ltr style="margin-right:0px"> <p align=left>&lt;tr&gt;</p> <blockquote dir=ltr style="margin-right:0px"> <p align=left>&lt;td&gt;</p></blockquote></blockquote> <p align=left>         &lt;SharePointWebControls:FieldValue id=&quot;Ctrl1........ &gt;&lt;/....&gt;'</p> <blockquote dir=ltr style="margin-right:0px"> <blockquote dir=ltr style="margin-right:0px"> <p align=left>&lt;td&gt;</p></blockquote> <p align=left>&lt;tr&gt;</p></blockquote> <p align=left>&lt;/MyConditionalPlaceHolder &gt;</p> <p align=left> </p> <p align=left> </p> <p align=left>Would appreciate your suggestions.</p> <p align=left> </p> <p align=left>Thanks,</p> <p align=left>Mo<br></p></font> <p align=left> </p>© 2009 Microsoft Corporation. All rights reserved.Mon, 30 Mar 2009 11:22:40 Zdcfc5fe2-5ee1-439a-af44-b59b5c6f59bdhttp://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#dcfc5fe2-5ee1-439a-af44-b59b5c6f59bdhttp://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#dcfc5fe2-5ee1-439a-af44-b59b5c6f59bdMohan Tanejahttp://social.technet.microsoft.com/Profile/en-US/?user=Mohan%20TanejaHow to hide controls when blank in a Layout Page?<p align=left><font face=Arial size=2>Hi All,</font></p> <p align=left> </p> <p>I want to hide a field (image in this case but could be any field) in a Page Layout when it is blank. This field is inside a table td tag</p> <p align=left> </p> <p align=left>i.e.</p> <p align=left> </p> <p align=left><font color="#000080">&lt;PublishingWebControls:EditModePanel PageDisplayMode=&quot;Display&quot; runat=&quot;server&quot; Wrap=&quot;false&quot; ID=&quot;disp&quot; Width=&quot;734px&quot;&gt;</font></p> <p align=left><font color="#000080"></font> </p> <p align=left><font color="#ff0000">&lt;what could be the tag here to display this conditionally i.e. only if user selected a image it should display&gt;</font></p> <p align=left><font color="#000080">    &lt;tr&gt;<br>           &lt;td&gt;<br>                    &lt;PublishingWebControls:RichImageField FieldName=&quot;PublishingRollupImage&quot; runat=&quot;server&quot;&gt;<br>                   &lt;/PublishingWebControls:RichImageField&gt;</font></p> <p><font color="#000080"></font> </p> <p align=left><font color="#000080">           &lt;/td&gt;</font></p> <p align=left><font color="#000080">    &lt;/tr&gt;</font></p> <p align=left><font color="#000080"></font> </p> <p align=left><font color="#000080"><font color="#ff0000">&lt;/end of condition&gt;</font></p> <p align=left> </p> <p align=left>&lt;/PublishingWebControls:EditModePanel&gt; </p> <p align=left> </p> <p align=left><strong>a)</strong> One way: Use &lt;WebPartPages<img alt="Big Smile" src="http://forums.microsoft.com/MSDN/emoticons/emotion-2.gif">ataFormWebPart ... &gt; </p> <p align=left>&lt;WebPartPages<img alt="Tongue Tied" src="http://forums.microsoft.com/MSDN/emoticons/emotion-7.gif">PDataSource DataSourceMode=&quot;ListItem&quot; ID=&quot;ds1&quot;  SelectCommand=&quot;&quot;&gt;<br></p> <blockquote dir=ltr style="margin-right:0px"> <p align=left>     &lt;SelectParameters&gt;<br>                       <font color="#ff0000">&lt;SharePointWebControls<img height=19 alt="Big Smile" src="http://forums.microsoft.com/MSDN/emoticons/emotion-2.gif" width=19>ataFormParameter ..... ??? what to pass here ??? &gt;<br></font>     <br>     &lt;/SelectParameters&gt;<br>    <br>    &lt;/WebPartPages<img height=19 alt="Tongue Tied" src="http://forums.microsoft.com/MSDN/emoticons/emotion-7.gif" width=19>PDataSource&gt;  <br></p></blockquote> <p align=left>i.e. <font color="#ff0000">how to refer to the current list Item in the DataFormWebPart ? </font></p> <p align=left><font color="#ff0000"></font> </p> <p align=left><strong>b)</strong>  Other way I can think of is to create a custom control inherited from asp<img alt="Stick out tongue" src="http://forums.microsoft.com/MSDN/emoticons/emotion-4.gif">laceholder, override the visible property, create a new property as controlsToCheck=&quot;ctrl1&quot; and check the value of this control &quot;ctrl1&quot; and if it is blank set the visible property to false otherwise true. </p> <p align=left>(I have not developed this this but probably it should work)</p> <p align=left> </p> <p align=left>On the pagelayout use the controls the following way:</p> <p align=left> </p> <p align=left>&lt;MyConditionalPlaceHolder  .... ControlToCheck=&quot;Ctrl1&quot; ....&gt;</p> <p align=left> </p> <blockquote dir=ltr style="margin-right:0px"> <p align=left>&lt;tr&gt;</p> <blockquote dir=ltr style="margin-right:0px"> <p align=left>&lt;td&gt;</p></blockquote></blockquote> <p align=left>         &lt;SharePointWebControls:FieldValue id=&quot;Ctrl1........ &gt;&lt;/....&gt;'</p> <blockquote dir=ltr style="margin-right:0px"> <blockquote dir=ltr style="margin-right:0px"> <p align=left>&lt;td&gt;</p></blockquote> <p align=left>&lt;tr&gt;</p></blockquote> <p align=left>&lt;/MyConditionalPlaceHolder &gt;</p> <p align=left> </p> <p align=left> </p> <p align=left>Would appreciate your suggestions.</p> <p align=left> </p> <p align=left>Thanks,</p> <p align=left>Mo<br></p></font> <p align=left> </p>Fri, 09 May 2008 23:18:21 Z2008-05-09T23:18:21Zhttp://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#e68aa5c7-201d-4a07-b3f1-2aab301ccb2bhttp://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#e68aa5c7-201d-4a07-b3f1-2aab301ccb2bmarcoskvhttp://social.technet.microsoft.com/Profile/en-US/?user=marcoskvHow to hide controls when blank in a Layout Page?Same problem here.<br>I created a page layout from a content type... and I would like to hide a field when empty.<br><br>For example I have<br><div style="overflow:auto;background-color:white;line-height:100% ! important;font-family:Courier New;font-size:11px"><table style="border-width:0px;margin:2px 0px;width:99%;border-collapse:collapse;background-color:rgb(255, 255, 255)" cellpadding=0 cellspacing=0><col style="font-family:Courier New;font-size:11px;padding-left:10px;white-space:nowrap"><tbody><tr><td><font style="font-size:11px"></font><font style="color:blue">&lt;</font><font style="font-size:11px">strong</font><font style="color:blue">&gt;</font><font style="font-size:11px">Date:</font><font style="color:blue">&lt;/</font><font style="font-size:11px">strong</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr><tr><td style="background-color:rgb(247, 247, 247)"><font style="color:blue">&lt;</font><font style="font-size:11px">SharePointWebControls:TextField </font><font style="color:red">FieldName</font><font style="font-size:11px">=</font><font style="color:blue">&quot;Project_x0020_Date&quot;</font><font style="font-size:11px"> </font><font style="color:red">runat</font><font style="font-size:11px">=</font><font style="color:blue">&quot;server&quot;</font><font style="font-size:11px">&gt;</font><font style="color:blue">&lt;/</font><font style="font-size:11px">SharePointWebControls:TextField</font><font style="color:blue">&gt;</font><font style="font-size:11px"> </font></td></tr></tbody></table></div><br><br>When <b>Project_x0020_Date</b> is empty would be nice to hide also the heading &quot;<font style="color:blue">&lt;</font><font style="font-size:11px">strong</font><font style="color:blue">&gt;</font><font style="font-size:11px">Date:</font><font style="color:blue">&lt;/</font><font style="font-size:11px">strong</font><font style="color:blue">&gt;</font><font style="font-size:11px">&quot; </font>.<br><br><br>Any hints to do that?<br>Many thanks in advance<br> Wed, 06 Aug 2008 12:51:05 Z2008-08-06T12:51:05Zhttp://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#0d57a32a-8314-4761-88b7-e91742644442http://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#0d57a32a-8314-4761-88b7-e91742644442Doug Warehttp://social.technet.microsoft.com/Profile/en-US/?user=Doug%20WareHow to hide controls when blank in a Layout Page?A couple of ideas...<br><br>Have a look at the rendered page to get the ID(s) of the controls you want to hide and use some JavaScript to check the contents and hide the elements as needed. <br><br>Or<br><br>Add code to the page's OnPreRender or (better) add a WebControl and add code to its OnPreRender to examine the controls on the page and hide as needed. If you go the control route you could expose a property that let you specify the controls to check and hide.<br><br>HTH,<br>--Doug<br><a href="http://www.elumenotion.com/blog">http://www.elumenotion.com/blog</a>Thu, 07 Aug 2008 00:36:01 Z2008-08-07T00:36:01Zhttp://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#b6b30975-1087-44d4-b425-af28549fe41ehttp://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#b6b30975-1087-44d4-b425-af28549fe41ePontus Haglundhttp://social.technet.microsoft.com/Profile/en-US/?user=Pontus%20HaglundHow to hide controls when blank in a Layout Page?<p>My solution to this problem (although not a very pretty one) is to have alternating Page Layouts based on the same Content Type. In that way I can have &quot;Article with image&quot; and &quot;Article without image&quot;.<br>You can at any time switch between the different layouts and no information is lost when going between them.<br><br>Pontus</p><hr class="sig">Pontus HaglundSun, 14 Dec 2008 10:53:47 Z2008-12-14T10:53:47Zhttp://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#a11b5e50-af87-4a66-a66e-c9fe833fdcd6http://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#a11b5e50-af87-4a66-a66e-c9fe833fdcd6pnsullivanhttp://social.technet.microsoft.com/Profile/en-US/?user=pnsullivanHow to hide controls when blank in a Layout Page?<p>If I understand correctly you could create a custom base layout page with all the logic you require to hide / display information on that particular page layout.<br><br>For example<br><br>aspx page.<br>&lt;%@ Page language=&quot;C#&quot;   Inherits=&quot;HHS.MOSS.SSEPublishingSite.SiteDefinition.CustomPageLayoutBase, HHS.MOSS.SSEPublishingSite.SiteDefinition, Version=1.0.0.0, Culture=neutral, PublicKey<br>Token=91e2a6d49fe103c0&quot; %&gt;<br><br>Codebehind cs file</p> <p>public class CustomPageLayoutBase: PublishingLayoutPage<br>    {<br>        protected PlaceHolder IntroPlaceHolder;<br>        protected PlaceHolder ApproveNewsPromotionPlaceHolder;</p> <p>        protected override void OnLoad(EventArgs e)<br>        {<br>            // Only show approvenewspromotion placeholder if not in display mode and current user belongs to sse member or owner group<br>            if (ApproveNewsPromotionPlaceHolder != null)<br>                ApproveNewsPromotionPlaceHolder.Visible = false; etc etc <br><br>Hope this helps</p>Wed, 17 Dec 2008 14:16:36 Z2008-12-17T14:16:36Zhttp://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#0390d490-f32f-4427-bba4-176cecee38d5http://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#0390d490-f32f-4427-bba4-176cecee38d5Andrew Connell [MVP]http://social.technet.microsoft.com/Profile/en-US/?user=Andrew%20Connell%20%5bMVP%5dHow to hide controls when blank in a Layout Page? We had the same issue with MCMS 2002, the predecessor to WCM. Best approach IMHO was to create a custom server control that you wrapped the FC's in. It did a check for all it's child controls and if their content was empty/null, it removed them from the Controls collection.<hr class="sig">-AC [MVP Office SharePoint Server] &lt;&gt; http://www.andrewconnell.com/blogMon, 22 Dec 2008 05:11:12 Z2008-12-22T05:11:12Zhttp://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#ad31d2bf-f70c-44f1-91b5-4d52ff8a8091http://social.technet.microsoft.com/Forums/en-US/sharepointecm/thread/dcfc5fe2-5ee1-439a-af44-b59b5c6f59bd#ad31d2bf-f70c-44f1-91b5-4d52ff8a8091Mohan Tanejahttp://social.technet.microsoft.com/Profile/en-US/?user=Mohan%20TanejaHow to hide controls when blank in a Layout Page?<div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white"> <table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0> <colgroup> <col style="border-right:gray 1px solid;padding-right:5px;padding-left:10px;font-size:11px;vertical-align:top;width:5px;color:gray;font-family:Courier New;background-color:#eee;text-align:right"> <col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap"> <tbody> <tr> <td><nobr>1</nobr></td> <td><font style="font-size:11px">[CLSCompliant(</font><font style="color:blue">false</font><font style="font-size:11px">)]  </font></td></tr> <tr> <td><nobr>2</nobr></td> <td style="background-color:#f7f7f7">[ParseChildren(</font><font style="color:blue">false</font><font style="font-size:11px">)]  </font></td></tr> <tr> <td><nobr>3</nobr></td> <td>[Guid(</font><font style="color:blue">&quot;please put a guid here&quot;</font><font style="font-size:11px">)]  </font></td></tr> <tr> <td><nobr>4</nobr></td> <td style="background-color:#f7f7f7"></font><font style="color:blue">public</font><font style="font-size:11px"> </font><font style="color:blue">class</font><font style="font-size:11px"> CustomTrimming : Microsoft.SharePoint.WebControls.SPSecurityTrimmedControl  </font></td></tr> <tr> <td><nobr>5</nobr></td> <td>{  </td></tr> <tr> <td><nobr>6</nobr></td> <td style="background-color:#f7f7f7"></font><font style="color:blue">public</font><font style="font-size:11px"> </font><font style="color:blue">string</font><font style="font-size:11px"> FieldNameToCheck {</font><font style="color:blue">get</font><font style="font-size:11px">;</font><font style="color:blue">set</font><font style="font-size:11px">;}  </font></td></tr> <tr> <td><nobr>7</nobr></td> <td></font><font style="color:blue">protected</font><font style="font-size:11px"> </font><font style="color:blue">override</font><font style="font-size:11px"> </font><font style="color:blue">void</font><font style="font-size:11px"> Render(HtmlTextWriter writer)  </font></td></tr> <tr> <td><nobr>8</nobr></td> <td style="background-color:#f7f7f7">{  </td></tr> <tr> <td><nobr>9</nobr></td> <td> SPListItem item = </font><font style="color:blue">null</font><font style="font-size:11px">;  <br><font color="#0000ff" size=2><font color="#0000ff" size=2> <p>if</font></font><font size=2> (!DesignMode)</p> <p>{</p></font></font></td></tr> <tr> <td><nobr>10</nobr></td> <td style="background-color:#f7f7f7">               </font><font style="color:blue">if</font><font style="font-size:11px"> (SPContext.Current != </font><font style="color:blue">null</font><font style="font-size:11px">)  </font></td></tr> <tr> <td><nobr>11</nobr></td> <td>                    {  </td></tr> <tr> <td><nobr>12</nobr></td> <td style="background-color:#f7f7f7">                        item = SPContext.Current.ListItem;  </td></tr> <tr> <td><nobr>13</nobr></td> <td>                    }  </td></tr> <tr> <td><nobr>14</nobr></td> <td style="background-color:#f7f7f7">                    </font><font style="color:blue">if</font><font style="font-size:11px"> ((FieldNameToCheck != </font><font style="color:blue">string</font><font style="font-size:11px">.Empty) &amp;&amp; (item != </font><font style="color:blue">null</font><font style="font-size:11px">))  </font></td></tr> <tr> <td><nobr>15</nobr></td> <td>                    {  </td></tr> <tr> <td><nobr>16</nobr></td> <td style="background-color:#f7f7f7">                          </td></tr> <tr> <td><nobr>17</nobr></td> <td>                        </font><font style="color:blue">if</font><font style="font-size:11px"> (CheckIfNullOrBlank(item[FieldNameToCheck]) == </font><font style="color:blue">false</font><font style="font-size:11px">)  </font></td></tr> <tr> <td><nobr>18</nobr></td> <td style="background-color:#f7f7f7">                        {  </td></tr> <tr> <td><nobr>19</nobr></td> <td>                            </font><font style="color:blue">base</font><font style="font-size:11px">.Render(writer);  </font></td></tr> <tr> <td><nobr>20</nobr></td> <td style="background-color:#f7f7f7">                        }  </td></tr> <tr> <td><nobr>21</nobr></td> <td>                     }  <br>}<br>else  // to display the nested controls / html when in SharePoint Designer 2007<br>{<br>           <font size=2> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>           base</font></font><font size=2>.Render(writer);</p></font><br>}</td></tr> <tr> <td><nobr>22</nobr></td> <td style="background-color:#f7f7f7">}  </td></tr> <tr> <td><nobr>23</nobr></td> <td> </td></tr> <tr> <td><nobr>24</nobr></td> <td style="background-color:#f7f7f7"></font><font style="color:blue">private</font><font style="font-size:11px"> </font><font style="color:blue">bool</font><font style="font-size:11px"> CheckIfNullOrBlank(</font><font style="color:blue">object</font><font style="font-size:11px"> data)  </font></td></tr> <tr> <td><nobr>25</nobr></td> <td>        {  </td></tr> <tr> <td><nobr>26</nobr></td> <td style="background-color:#f7f7f7">            </font><font style="color:blue">if</font><font style="font-size:11px"> (data == </font><font style="color:blue">null</font><font style="font-size:11px"> || (Convert.ToString(data).Trim() == </font><font style="color:blue">string</font><font style="font-size:11px">.Empty))  </font></td></tr> <tr> <td><nobr>27</nobr></td> <td>            {  </td></tr> <tr> <td><nobr>28</nobr></td> <td style="background-color:#f7f7f7">                    </font><font style="color:blue">return</font><font style="font-size:11px"> </font><font style="color:blue">true</font><font style="font-size:11px">;  </font></td></tr> <tr> <td><nobr>29</nobr></td> <td>            }  </td></tr> <tr> <td><nobr>30</nobr></td> <td style="background-color:#f7f7f7">            </font><font style="color:blue">else</font><font style="font-size:11px"> </font></td></tr> <tr> <td><nobr>31</nobr></td> <td>            {  </td></tr> <tr> <td><nobr>32</nobr></td> <td style="background-color:#f7f7f7">                    </font><font style="color:blue">return</font><font style="font-size:11px"> </font><font style="color:blue">false</font><font style="font-size:11px">;  </font></td></tr> <tr> <td><nobr>33</nobr></td> <td>            }  </td></tr> <tr> <td><nobr>34</nobr></td> <td style="background-color:#f7f7f7">        }  </td></tr> <tr> <td><nobr>35</nobr></td> <td> </td></tr> <tr> <td><nobr>36</nobr></td> <td style="background-color:#f7f7f7">}  </td></tr> <tr> <td><nobr>37</nobr></td> <td> </td></tr></tbody></table></div>Hi Everyone,<br>First of all I appreciate and thanks everyone to post your responses. Am coming back to this post after a long time,<br>to post the solution I had used.<br><br> <p><font size=2>Please compile the above code and check for typos since I extracted this from a code doing other things as well. From within the page using SPContext we have access to the data for the same page, hence we can check its value and decide to either render or not render the nested control contents.<br><br>Here is how usage would look like:<br><br>&lt;custom:HideWhenBlank  runat=&quot;server&quot; FieldNameToCheck=&quot;ImageFieldHere&quot;&gt;<br>....<br>.. &lt;...... Field=&quot;ImageFieldHere&quot;    &gt;<br>  <br><br>&lt;/custom:HideWhenBlank&gt;<br><br>so the value of &quot;ImageFieldHere&quot; will be checked before displaying the image and if it is blank, all the HTML and publishing controls inside the &lt;custom:HideWhenBlank&gt; tags will not be parsed and vice versa, i.e. if the image does exist it will be shown.<br>Also as a note 1) this will work for all data types and not just image types.<br>2) It is not necessary to inherit from <font size=2>SPSecurityTrimmedControl  and you could use other UI base control.<br>3) In SPD in design mode you will continue to see the nested controls (a check made in above code for design mode), since we would not have access to SPContext at that time. We can the see the end result when the page is shown in browser.<br></font><br>I used the above is SPD 2007 and it worked well.<br><br><br>Best Wishes,<br>Mo<br></p></font>Sat, 17 Jan 2009 02:32:14 Z2009-01-17T02:34:20Z