Friday, 19 October 2012

I Deleted My Last Post About Dynamically Rendering Controls From a SharePoint List

because I was stupid enough to forget that it is impossible, without a lot of fuss and bother, to add event handing to controls which are only rendered at runtime. I'll just take my dunce hat and sit in the corner.

It was not a total waste of time, however, as I was able to use the looping code and Response.Write to write the markup to a text file and then stick it back into the ASPX page. But as they say when looking for directions in Ireland, my home country, "well I wouldn't start from here if I were you."

Sigh. The loop DOES work well when submitting to list and that's coming up shortly.

Monday, 1 October 2012

Oi! My Content Editor Web Part is Borked!

Had an issue today where I got an email saying "ever had this error before?" It was a Content Editor Web Part (those thingies that allow you to add fancy text to a SharePoint page via a web part) that was causing the browser to throw errors. The browser was apparently failing to recognise the background colour or some other bit of javascript. Also the context menu that dropped down from the "edit" command on the web part - viewable when you select "Edit Page" - was not dropping down. The whole thing seemed borked.

I tried adding in a few other Content Editor Web Parts and for the most part they broke in the same way. I closed them using the Web Parts Maintenance Page (which is like the regular page only you add ?contents=1 to the URL) and then had a look at the original web part. Clicking Source Text Editor, I noticed the following.
<DIV blah blah blah piles of attributes that looked as if they'd been lifted out of MS Word etc etc>

Since the DIV contained no text or formatting, I deleted it and refreshed the web part. Hey presto, the borkedness was fixed. The tags were interfering with the HTML. Interesting indeed if this is being caused by SharePoint's very own Rich Text Editor!