Calendar newform.aspx multiple content types and default values. RRS feed

  • Question

  • SharePoint 2010 provides some new features on Calander views (of the OOTB calendar list). You can select a portion of the day and click "new event" directly in the calendar. This will take the selected startdate/time and enddate/time and prefill this in the newform. When you enable Group Planning on the calendar it will also take the user (of the selected calendar) and prefill it in the newform as well. Very nice.

    I have created multiple content types on the OOTB calendar and would like the give the user a intinuitive UI of selecting the correct content type. The idea is as follows. The user selects a portion of the day, and click "new event" directly from the calendar. The user is taken to a custom page where he can select the desired content type and is then taken to the new form of the selected content type.

    Now I'd like to take the values selected by the user (eventdate, enddate and user) and use them to create links to the newforms of the different content types. In Moss 2007 the selected values (startdate and starttime) were passed with the Querystring, which prefilled the newform. But in SharePoint 2010 these values are passed in some other way (javascript?)

    How can i get these values (eventdate, enddate and user) and create multiple links with these values, which will pass them to a newform of the selected content type.



    Monday, August 23, 2010 9:56 PM


  • Hello Marcvanejk,

    You could drop a data source control on a page and bind it to your list. Expose the content type column in the drop down menu.

    Also, on that page you could insert multiple web parts, one for each of the content types. Each of them should already be wired up to consume the data/time parameters. This data should already be there based on what the user clicked previously when redirected to this page.

    This is an assumption on my part as my farm is giving me some guff currently and I cannot test this.

    Now, from another post I responded to I'm going to lift some XSLT magic.

    The part I think you could leverage is this:

    <xsl:template match="/">
    <xsl:if test="$contentType = '0x0107'">
    <xsl:call-template name="dvt_1"/>

    Instead of using a URL query string parameter you could bind it to the control that is displaying your content type drop down. Each web part would use this but only display the new form web part when the right content type is selected.

    The part I'm a bit worried about is if you'll lose the URL query string parameters for your data/time.

    Dalibor K
    Microsoft Online Community Support
    • Marked as answer by Wayne Fan Friday, November 5, 2010 5:47 AM
    Sunday, October 24, 2010 10:29 PM