sharepoint - Web Part connections in site definitions -


I need to specify the Web Part connection in onet.xml. Therefore, when creating a site using this site definition It has been said that Web Parts are already connected and ready for use. What properties I need to specify in that onet.xml for that specific web parts.

I even walled on this one in the past year! It seems that connections can no longer be specified on web parts in the new .webpart format because they can be in the old .dwp format. I also eliminate custom attributes like Site Definition such as KPinhack suggest too. To add web parts, my code is listed below. The method is designed to connect only two different types of web parts - it does not support many web parts of the same type of same page. But I'm sure you'll catch the general idea.

  Private Zero ConnectWeb Pars (SPWeb Web, String PageName, Type Provider Type, Type Consumer Type) {SP File File = Web. Gatefile (PageName); SPList list = null; If (file.InDocumentLibrary) {list = file.Item.ParentList; If (list.ForceCheckout) file.CheckOut (); } SPLimitedWebPartManager webPartManager = web.GetLimitedWebPartManager (PageName, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared); WebPart Provider = Faucet; Forex Currency (WebPartManager.WebPartsWebPart WP) {if (wp.GetType () == Provider type) {Provider = wp; break; }} Foreach (WebPartManager.WebParts Webpage Consumer) {If (consumer.GetType ()! = ConsumerType) continues; ProviderConclusionPointCollection providerConnection = webPartManager.GetProviderConnectionPoints (Provider); Provider EnhancePoint Provider Connection = Provider Connection [0]; Consumer Connection PointCollection Consumer Connection = webPartManager.GetConsumerConnectionPoints (Consumer); Consumer Connection Connection Consumer Connection = Consumer Connection [0]; SPWebPartConnection con = webPartManager.SPConnectWebParts (provider, provider connection, consumer, consumer connection); WebPartManager.SPWebPartConnections.Add (thief); } If (list! = Null) {if (list.ForceCheckout) {file.CheckIn ("Added Web Part Connections"); } If (list.EnableVersioning & amp; list.EnabledInternet version) {file.Publish ("Web Part connection added"); }}}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -