Content Studio Web Content Management System
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
true if the field exists, false otherwise.
The following code snippet shows how the TryGetValue method can be used (the example only works in a Content Studio presentation template).
[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
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. This parameter will never be null (Nothing in Visual Basic) even if the underlying field value is null.
Return Value
Type: Booleantrue if the field exists, false otherwise.
Examples
C#
string Value; if(!CS_DataFields.TryGetValue("Header", out Value)) 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) 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