AnswerOption class

From Catglobe Wiki
Jump to: navigation, search

AnswerOption



The answer option template

Parent class

Inherits from object

Constructors

  • (QuestionTemplate question "The question contains this answer option") - Create new answer option and add it into question. Default its value is max options + 1
  • (int id "Answer option id") - Fetch exist answer option template

Methods

  • (From object) string ToString() - The string representation of the object.

Properties

  • bool HasData { get; } - Check if this answer option contains data or not
  • int Id { get; } - Answer option id
  • string ObjectTypeName { get; } - The name of the type of object.
  • LocalizedString Text { get; set; } - Answer option text
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.
  • int Value { get; set; } - Answer option value

Examples

// new AnswerOption for a question 
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
QuestionTemplate q = qt.GetQuestion("Q1");
AnswerOption ao = new AnswerOption (q);
ao.Text.SetTranslation ("", "Option 3");
qt.Save(true);