Wow, wow, wow...
I've spent the better part of a week spinning my wheels, trying to figure out how to get a simple informational message back to VIEW.ASCX to display the contents of the ContentItemId field from CONTENT.CS.
Well, I never did get a message back to VIEW.ASCX (lblMessage won't work, MessageBox won't work, DotNetNuke.Common.Globals.NavigateURL() will work but you can't display anything, etc., etc.). I then tried to get HttpContext.Current.*, System.Debugger.*, etc to write debugging messages to the OUTBOX in VS 12 Web Developer, but I never found any of those messages.
But I finally DID get TEXTWRITERTRACELISTENER to work using the following code:
// set up listener
string filename = @"C:\Users\Jeff McVey\Desktop\listener.txt";
FileStream traceLog = new FileStream(filename, FileMode.OpenOrCreate);
TextWriterTraceListener listener = new TextWriterTraceListener(traceLog);
// output to listener
listener.WriteLine("objContent.ContentItemId 1:" + objContent.ContentItemId.ToString());
// Add Terms
var cntTerm = new Terms();
cntTerm.ManageTaskTerms(objTask, objContent);
// output to listener
listener.WriteLine("objContent.ContentItemId 2:" + objContent.ContentItemId.ToString());
// flush any open output before termination
// maybe in an override of Form.OnClosed
listener.Flush();
listener.Close();
*****************************************************************************************************
Output file contains:
objContent.ContentItemId 1:501
objContent.ContentItemId 2:501
(I also visually verified its presence as 501 in the CONTENTITEM file.)
You'll notice that I sampled the value of objectContent.ContentItemId BEFORE and AFTER it went down the rabbit-hole of cntTerm.ManageTaskTerms().
Looks like objcontent.ContentItemId retains its value in and out of that rabbit hole, but I don't necessarily know that it is used to write the final value to the CONTENTITEM file, so I'll have to go down that rabbit hole myself to see what does.
More later, as it happens. I think this is all for today.
Jeff
// System.Diagnostics.Debugger.Log(0,null,"objContent.ContentItemId 2:" + objContent.ContentItemId.ToString());
// System.Diagnostics.Debugger.Break();
// System.Web.HttpContext.Current.Response.Output.Write("objContent.ContentItemId 2: " + objContent.ContentItemId.ToString());