protected void SubmitQuestionButton_Click(object sender, EventArgs e) { var title = txtQuestionTitle.Text; var body = txtQuestion.Text; string topic = String.IsNullOrEmpty(ddlTopics.SelectedValue.ToString()) ? String.Empty : ddlTopics.SelectedValue.ToString(); string grade = String.IsNullOrEmpty(ddlGrades.SelectedValue.ToString()) ? String.Empty : ddlGrades.SelectedValue.ToString(); var user = ""; try { if (this.CurrentMember.ScreenName != String.Empty || this.CurrentMember.ScreenName != null) { user = this.CurrentMember.ScreenName; } } catch { user = "******"; } List <string> issues = new List <string>(); //save selected issues foreach (var item in uxIssues.Items) { var checkbox = item.FindControl("uxIssueCheckbox") as CheckBox; var hidden = item.FindControl("uxIssueHidden") as HiddenField; if (checkbox.Checked) { issues.Add(hidden.Value); //singleChild.Issues.Add(new Issue() { Key = Guid.Parse(checkbox.Attributes["value"]) }); //singleChild.Issues.Add(new Issue() { Key = Guid.Parse(hidden.Value) }); } } var newQuestion = TelligentService.CreateQuestion(title, body, grade, topic, issues, user); if (newQuestion != null) { var url = "/en/Community and Events/Q and A/Q and A Details.aspx" + newQuestion.QueryString; Item item = Questions.CreateSitecoreQuestion(title, newQuestion.WikiId, newQuestion.WikiPageId, newQuestion.ContentId, grade, topic, issues, Sitecore.Context.Language); if (item != null) { //error_msg.Visible = false; //Redirect to discussion //Publish thread item PublishItem(item); //Sitecore.Web.WebUtil.Redirect(Sitecore.Links.LinkManager.GetItemUrl(threadItem)); /// clientsideScript("alert('" +String.Format( DictionaryConstants.ForumCreateConfirmation,subject)+"');"); //Page.Response.Redirect(Page.Request.Url.ToString(), false); } Response.Redirect(url); } else { //The assumption is that if the Thread is null, then there was an error in telligent API call and nothing was created //error_msg.Text = DictionaryConstants.FailedToCreateDiscussionError; //error_msg.Visible = true; //ShowClientSideForm(HiddenText); var url = "/community-and-events/q-and-a"; Response.Redirect(url); } }