public string GetHeader(CSVExportData.ExportAnswersRow header) { string splitChar = "|"; switch (ddlHeader.SelectedValue) { case "Question": if (!header.IsRowOrderNull()) return TrimSplit((header.ParentQuestionText + splitChar + header.QuestionText + splitChar + header.AnswerText)); else return TrimSplit((header.QuestionText + splitChar + header.AnswerText)); case "QuestionDisplayOrderNumber": if (!header.IsRowOrderNull()) return TrimSplit(header.QuestionDisplayOrder.ToString() + splitChar + header.RowOrder.ToString() + splitChar + header.AnswerText); else return TrimSplit(header.QuestionDisplayOrder.ToString() + splitChar + header.AnswerDisplayOrder.ToString()); case "QuestionID": if (!header.IsRowOrderNull()) return TrimSplit((header.IsParentQuestionIdTextNull() ? string.Empty : header.ParentQuestionIdText) + splitChar + header.RowOrder.ToString() + splitChar + (header.IsAnswerTextNull() ? string.Empty : header.AnswerText)); else return TrimSplit((header.IsQuestionIdTextNull() ? header.QuestionText : header.QuestionIdText) + splitChar + (header.IsAnswerIdTextNull() ? string.Empty : header.AnswerIdText)); case "QuestionAlias": if (!header.IsRowOrderNull()) return TrimSplit(header.ParentQuestionAliasText.ToString() + splitChar + header.RowOrder.ToString() + splitChar + header.AnswerText); else return TrimSplit(header.IsQuestionAliasNull() ? header.QuestionText : header.QuestionAlias + splitChar + (header.IsAnswerAliasNull() ? header.IsAnswerTextNull() ? string.Empty : header.AnswerText : header.AnswerAlias)); case "QuestionIDAlias": if (!header.IsRowOrderNull()) return TrimSplit((header.IsParentQuestionIdTextNull() ? string.Empty : header.ParentQuestionIdText) + " " + (header.IsParentQuestionAliasTextNull() ? string.Empty : header.ParentQuestionAliasText) + splitChar + header.RowOrder.ToString() + splitChar + header.AnswerText); else return TrimSplit(header.IsQuestionIdTextNull() ? string.Empty : header.QuestionIdText + " " + (header.IsQuestionAliasNull() ? string.Empty : header.QuestionAlias) + "| " + (header.IsAnswerIdTextNull() ? string.Empty : header.AnswerIdText) + " " + (header.IsAnswerAliasNull() ? string.Empty : header.AnswerAlias)); default: return TrimSplit("Invalid DDl Value"); } }