<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>MOSS 2007</title>
        <link>http://geekswithblogs.net/sevans/category/6625.aspx</link>
        <description>MOSS 2007</description>
        <language>en-US</language>
        <copyright>Stuart Evans</copyright>
        <managingEditor>sevans@appsolutions.co.uk</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>MOSS2007: Add Custom Wizard Style Navigation To Your Sharepoint Designer Pages Using Inline C#</title>
            <link>http://geekswithblogs.net/sevans/archive/2007/05/14/112496.aspx</link>
            <description>&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;My customer has a requiirement for simple wizard style (ie Next&amp;gt;&amp;gt;Next) navigation&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;Typical Example would be to enter details for a purchase order header, then to press "Next" and the user is taken immediately to the window for adding lines.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;strong&gt;&lt;u&gt;&lt;font size="4"&gt;Investigation&lt;/font&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;I found number of ways to manipulate the navigation options of a SharePoint edit form page these being:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;1) You can add a source querystring parameter to the url of the first page. This allows you to enter details for the header and then get routed to the child page that you specify in the source querystring variable as per this &lt;/font&gt;&lt;a href="http://www.graphicalwonder.com/?p=666"&gt;&lt;font size="2"&gt;post&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;2. You can open you NewForm.aspx , HIDE the standard list form DONT DELETE IT  (refer to &lt;font face="Arial"&gt;&lt;a href="http://blogs.msdn.com/dszabo/archive/2007/02/20/custom-list-newform-aspx-ruined-in-wss-3-0.aspx"&gt;http://blogs.msdn.com/dszabo/archive/2007/02/20/custom-list-newform-aspx-ruined-in-wss-3-0.aspx&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; for details why)  insert a custom list form and remove the sharepoint:savebutton controls and replace them with form action controls. The form action controls have a number of options - these being documented &lt;/font&gt;&lt;a href="http://office.microsoft.com/en-us/sharepointdesigner/HA101191121033.aspx"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; . However in my example I wanted to append the url of the redirect with a querystring property and after loads of investigation of trying to customise the navigate to page option of the form action control I gave up (the JavaScript code generates a postback to the server which controls the redirect process. The catch is that the JavaScript is generated using xslt and it beat me. Challenge anyone to get it working!)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;3. You could replace the sharepoint:savebutton with a standard asp.net button and wire it up to some inline inline C#. As mentioned in my example I wanted to save the data entered and add a runtime querystring parameter to the end of the url.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;So. to achieve a simpl save and redirect you can implement the following :&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;1. Add your inline C# code to your SharePoint page (i.e.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;&amp;lt;script type="text/c#" runat="server"&amp;gt;&lt;br /&gt;
    void SaveAndRedirect(object sender, System.EventArgs e)&lt;br /&gt;
    {&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;//Implement your own code for creating the url&lt;br /&gt;
  string redirectUrl ="http://vsmoss?paramName=12345";&lt;br /&gt;
  SPContext.GetContext(this.Context).Item.Update();&lt;br /&gt;
  Response.Redirect(redirectUrl  );&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;2. Add PageParserPath entry to your web.config. You will need to modify the virtual path to reflect the name and url of your custom page.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;&amp;lt;PageParserPaths&amp;gt;  &lt;br /&gt;
&amp;lt;PageParserPath VirtualPath="/Services/Lists/Calendar/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" /&amp;gt;&lt;br /&gt;
&amp;lt;/PageParserPaths&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;3. Add your asp.net button to your page.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt; &amp;lt;asp:Button runat="server" Text="Button" id="Button1" OnClick="SaveAndRedirect"/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;You will need to restart IIS for the changes to take effect.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;This technique is an extension to a post from &lt;a href="http://weblog.vb-tech.com/nick/archive/2006/08/03/1710.aspx"&gt;Nick Swan&lt;/a&gt; who discusses inlining C# in master pages but isn’t too keen on thee idea. I'm open to suggestions as to whether standard aspx pages are candidates for this type of modification.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;strong&gt;&lt;u&gt;&lt;font size="4"&gt;Conclusion&lt;/font&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;If you need simple navigation logic then this technique works. &lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 6.5pt; FONT-FAMILY: Arial"&gt;&lt;font size="2"&gt;Of course there is more than likely a slicker solut&lt;/font&gt;&lt;/span&gt;ion that I haven’t thought of . I guess the most likely solution would be to create a SharePoint form control that inherits from one if the controls in the Microsoft.Sharepoint.WebControls namespace. I attempted this and managed to get it rendering in SPD but kept getting runtime errors that I couldn’t get to the bottom of. If anyone has implemented a custom SharePoint form button I'd love to find out how they got it working.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=112496"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=112496" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/sevans/aggbug/112496.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stuart Evans</dc:creator>
            <guid>http://geekswithblogs.net/sevans/archive/2007/05/14/112496.aspx</guid>
            <pubDate>Mon, 14 May 2007 22:38:36 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/sevans/comments/112496.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/sevans/archive/2007/05/14/112496.aspx#feedback</comments>
            <slash:comments>10</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/sevans/comments/commentRss/112496.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/sevans/services/trackbacks/112496.aspx</trackback:ping>
        </item>
    </channel>
</rss>