EPTXmlParserTryGetValue Method (String, String, Boolean) Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

Gets the value associated with the specified field name.

Namespace: ContentStudio.Document.EPT
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax

public bool TryGetValue(
	string fieldName,
	out string value,
	bool avoidNull
)

Parameters

fieldName
Type: SystemString
The name of a field to get the value for. This name is case sensitive.
value
Type: SystemString
When this method returns this parameter contains the value associated with the specified field, if the field is found; otherwise, an empty string. This parameter is passed uninitialized.
avoidNull
Type: SystemBoolean
Determines if the value parameter can be null (Nothing in Visual Basic) after the method returns or not.

Return Value

Type: Boolean
true if the field exists, false otherwise.
Examples

The following code snippet shows how the TryGetValue method can be used (the example only works in a Content Studio presentation template).

C#
string Value;
if(!CS_DataFields.TryGetValue("Header", out Value, true))
    Response.Write("The Header field does not exist!");
else
{
    if(Value.Length == 0)
        Response.Write("The Header field is empty!");
    else
        Response.Write("The Header field value is: " + Value);
}
Visual Basic
Dim Value As String
If Not CS_DataFields.TryGetValue("Header", Value, True) Then
    Response.Write("The Header field does not exist!")
ElseIf Value.Length = 0 Then
    Response.Write("The Header field is empty!")
Else
    Response.Write("The Header field value is: " & Value)
End If
See Also

Reference