I'm quiet new to Sharepoint and ASP.NET and by far not an coding expert. I actually have a quiet simple question
I'm building a custom publishing site-layout with several WebControls (RichImageField,RichHtmlField,SummaryLinkFieldControl,Userfield ...). Each WebControl is wrapped in a <div>, some of them get extra markup like a <h3> (Title) or <span> (some description).
How do I output some code based on the condition of a WebControl (= field has Content or field has no content).
For Example: I want to output the following snippet, only if "TestField" has content.
<div class="wrapper>
<h3>Test Field</h3>
<PublishingWebControls:SummaryLinkFieldControl runat="server" FieldName="TestField" />
</div>
Otherwise do not output anything. (I don't want to hide it via JS or CSS)
In PHP I simply can do:
<?php if (isset($foo)) {
echo $foo;
} ?>
or
<?php if !empty($foo)) {
echo $foo;
} ?>
Is there something like this in ASP?
Maybe I'm totally wrong and has to change the output of an WebControl itself somewhere else. Thanks for any advice.

0 commentaires:
Enregistrer un commentaire