Documentation > Services API > ServicesOutput > RenderConditionalString(String,String,String,String,String)
RenderConditionalString
Related to RederConditionalField but for a string input. Useful if the condition being checked is output resulting from a previous renderConditionalField or RenderConditionalString rather than from a single or specific field
public System.String RenderConditionalString(String,String,String,String,String)
Parameters
Name | Description | Type |
---|---|---|
inputString | String to check | System.String |
tagWrapper | HTML tags that will wrap the output tagWrapper overrides codeFormat | System.String |
tagID | ID attribute for HTML tag | System.String |
tagClass | Class attribute for HTML tag | System.String |
codeFormat | Custom format for outputing the field content in a formatted string | System.String |
Code Example
C#
Sample:
string string1 = asset["some_string"]; string string2 = ServicesOutput.RenderConditionalString(string1, "div", "first", "divClass" ); Out.WriteLine( ServicesOutput.RenderConditionalString(string2, codeFormat: "<p><h3>My HTML Code:</h3> {0} </p>" ); //returns and outputs: <p><h3>My HTML Code:</h3> <div id="first" class="divClass">Content of some_string<div>\n </p>