Last post Jul 09, 2013 03:49 AM by magnusburton
Jul 02, 2013 04:48 AM|magnusburton|LINK
Please notice: I have no idea if this is the correct forum to post in but I'll give it a shot. Please move my thread if it's not posted in the correct one. Also keep in mind that I was set on this task by my boss and I have never worked with ASP.NET
or SQL servers, only MySQL and PHP but I pretty much understand ASP.NET now (moderately).
I have a TinyMCE script on my ASP.NET page and with help of the function
SaveFAQ() we can save the textarea(s) that the TineMCE uses.
private void SaveFAQ(bool returnToFAQ = false)
DataSet ds = new DataSet();
if (mceQuestion.Value.Length > 7)
if (mceQuestion.Value.Substring(0, 3) == "<p>" && "</p>" == mceQuestion.Value.Substring(mceQuestion.Value.Length - 4, 4))
mceQuestion.Value = mceQuestion.Value.Substring(3, mceQuestion.Value.Length - 7);
if (DateTime.TryParse(txtQuestionOfTheDay.Text, out tmp))
faqFromDate = tmp;
faqFromDate = null;
ds = _server.AdminSaveFAQ(FAQ_Id, chbHighlight.Checked, LAN_Id_Primary, mceQuestion.Value, mceAnswer.Value, txtFlash.Text, mceStepByStep.Value, mceTip.Value, faqFromDate, chbImportant.Checked);
if (FAQ_Id == 0)
FAQ_Id = (int)ds.Tables.Rows["FAQ_Id"];
foreach (Control c in pnlCheckbox.Controls)
if (c.GetType() == typeof(CheckBox))
_server.AdminSaveFAQCategory(FAQ_Id, int.Parse(((CheckBox)c).ID), ((CheckBox)c).Checked);
lblStatusUp.Visible = true;
lblStatusDown.Visible = true;
lblStatusUp.Text = "Saved successfully!";
lblStatusDown.Text = "Saved successfully!";
lblStatusUp.ForeColor = System.Drawing.Color.Green;
lblStatusDown.ForeColor = System.Drawing.Color.Green;
lblStatusDown.Text = "Error while saving!";
lblStatusUp.Text = "Error while saving!";
lblStatusUp.ForeColor = System.Drawing.Color.Red;
lblStatusDown.ForeColor = System.Drawing.Color.Red;
//if (Session["PreviousPage"] != null) Response.Redirect(Session["PreviousPage"].ToString());
The first time I press the save-button it triggers a event which executes this function SaveFaq(). It successfully creates a row in the database and such but the strings mceQuestion.Value & mceAnswer.Value are empty. The second time I press the button it triggers the exact same event and the values are filled and it saves successfully.
<textarea ID="mceQuestion" runat="server" cols="100" rows="6" />
How can I do so that I just have to press save once? Could this be due to a viewstate bug or maybe TinyMCE messing with my textareas?
Appreciate all answers, have a great day!
Jul 09, 2013 03:37 AM|Angie xu - MSFT|LINK
I just noticed that you have given the same post in Stackoverflow, and you solved this issue by yourself,
fixed it by adding OnClientClick="tinyMCE.triggerSave(false,true);" to each saving-button.
If any community member is intersted in this topic, you can learn relevant discussion in the link above,
Jul 09, 2013 03:49 AM|magnusburton|LINK
What do you mean? How do i add it as a relevant discussion?