Indeed. That's the best part about it. Every article I'd referenced seemed to be unnecessarily complicating matters by doing this.
From: [email protected] [mailto:[email protected]] On Behalf Of Sezai Komur Sent: Tuesday, 16 March 2010 1:49 PM To: ozMOSS Subject: Re: Code support No worries Paul, and no need for a custom field type + custom field control either. Sezai. On Tue, Mar 16, 2010 at 10:25 AM, Paul Noone <[email protected]<mailto:[email protected]>> wrote: Got it working! Eureka. Woo-hoo. Yeeeee-haw. And other cheers of delight. Thanks to everyone for their support, and to Sezai for providing a viable approach for my ill-framed idea. :D From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Sezai Komur Sent: Tuesday, 16 March 2010 12:31 PM To: ozMOSS Subject: Re: Code support You could try this instead. if(SPContext.Current.ListItem.GetFormattedValue("NEALS")=="Yes") Sezai. On Tue, Mar 16, 2010 at 9:24 AM, Paul Noone <[email protected]<mailto:[email protected]>> wrote: Getting closer but more errors have come as a result. :) Error 1 The as operator must be used with a reference type or nullable type ('bool' is a non-nullable value type) Error 2 The name 'True' does not exist in the current context Regards, Paul Online Developer, ICT CEO Sydney From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Sezai Komur Sent: Tuesday, 16 March 2010 12:18 PM To: ozMOSS Subject: Re: Code support protected override void OnLoad(EventArgs e) :) Seems my writing code directly in email without intellisense aint up to scratch. Sezai On Tue, Mar 16, 2010 at 8:46 AM, Paul Noone <[email protected]<mailto:[email protected]>> wrote: Hi Dan, That would be why then. :) OK. This is what I'm trying to do as per Sezai's suggestion the other day. 1. Create custom control with pre-defined HTML content. 2. Add a boolean column "NEALS" to my Article Page content type. 3. Add this field to the required layout pages and wrap it in an editmodepanel so it only renders in edit mode and allows content authors to switch it on/off. 4. Add my custom control to the layout page which renders the required content if the Boolean is set to True. I'm sure the control should be very simple but I'm not sure what to inherit from or how to create a wrapper for the custom HTML content. Should I be overriding CreateChildControls instead? protected override void CreateChildControls() { if ((SPContext.Current.ListItem["NEALS"] as Boolean) == True) { this.Controls.Add(new LiteralControl("<div id="myIcon">My HTML snippet here!</div>")); Regards, Paul Online Developer, ICT CEO Sydney From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Daniel W. Brown Sent: Tuesday, 16 March 2010 11:31 AM To: ozMOSS Subject: RE: Code support Howdy Paul, The class, LiteralControl does not have a Page_Load method as it is a control :) List of members: http://msdn.microsoft.com/en-us/library/system.web.ui.literalcontrol_members.aspx You may need to override Init or Load depending on what you are tyring to do. Also, http://msdn.microsoft.com/en-us/library/ms178472.aspx is a great resource for figuring out which methods are executed in the lifecycle of a control. Cheers, Daniel From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Paul Noone Sent: Tuesday, 16 March 2010 10:48 AM To: ozMOSS Subject: Code support Hi all, Can anyone tell me what's wrong with this snippet. I'm trying to override a server control that inherits from LiteralControl and am getting the following error. 'CEO.SharePoint.Controls.ShowNEALSlogo.Page_Load(object, System.EventArgs)': no suitable method found to override using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Microsoft.SharePoint; namespace CEO.SharePoint.Controls { public class ShowNEALSlogo : LiteralControl { public override void Page_Load(object sender, System.EventArgs e) { if ((SPContext.Current.ListItem["NEALS"] as Boolean) == True) Kind regards, Paul Noone --------------------------------------------------- Online Developer Information Communication and Technology Catholic Ecuation Office, Sydney p: (02) 9568 8461 f: (02) 9568 8483 e: [email protected]<mailto:[email protected]> w: http://www.ceosyd.catholic.edu.au/ _______________________________________________ ozmoss mailing list [email protected]<mailto:[email protected]> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss _______________________________________________ ozmoss mailing list [email protected]<mailto:[email protected]> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss _______________________________________________ ozmoss mailing list [email protected]<mailto:[email protected]> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
_______________________________________________ ozmoss mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
