I have created a simple user control that creates forum topics.......
The user control works perfectly...... but it only works once...
for example only lets u create 1 topic.
if you try and add another topic via the control it just reloads the page with an empty form...
i have tried attaching to process and debugging and it lets you step through the first time, but when you run it for a second time it doesnt even hit the breakpoint and it just seems like nothing is happening.
am i doing something wrong?? do i need to change an umbraco setting to allow multiple docs to be created or something??
protected void btnCreate_Click(object sender, EventArgs e) { //Get the Document types var topicDocType = DocumentType.GetByAlias("ForumTopic"); var postDocType = DocumentType.GetByAlias("ForumPost");
//create a user var u = new User(0);
//create the post title string postTitle = txtMessage.Text; if (postTitle.Length > 10) postTitle = postTitle.Substring(0, 10) + "...";
//Create the topic document var topicDoc = Document.MakeNew(txtTitle.Text, topicDocType, u, CurrentPageId); topicDoc.getProperty("topicTitle").Value = txtTitle.Text; topicDoc.Publish(u); //if (topicDoc.Published) umbraco.library.UpdateDocumentCache(topicDoc.Id);
// create the post doc var postDoc = Document.MakeNew(postTitle, postDocType, u, topicDoc.Id); postDoc.getProperty("postMessage").Value = txtMessage.Text; postDoc.Publish(u); //if (postDoc.Published) umbraco.library.UpdateDocumentCache(postDoc.Id);
User control - strange behaviour
Hi,
I have created a simple user control that creates forum topics.......
The user control works perfectly...... but it only works once...
for example only lets u create 1 topic.
if you try and add another topic via the control it just reloads the page with an empty form...
i have tried attaching to process and debugging and it lets you step through the first time, but when you run it for a second time it doesnt even hit the breakpoint and it just seems like nothing is happening.
am i doing something wrong?? do i need to change an umbraco setting to allow multiple docs to be created or something??
please help its driving me crazy lol!
is working on a reply...