Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 6th, 2008, 09:26 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

I did not suggest to use XSLT to generate ASP.NET controls, that seems to be a choice you have made. My suggestions on this thread aim to get that working, once you have made that choice. Your earlier attempts failed completely in getting the calender control to be created. The way you create the control does not matter and I don't see why the code I have suggested forces you to put the calender on every page, you can always use conditions in your code to insert the calendar when and where you want it inserted.

If you want to use XSLT to create ASP.NET controls like an asp:Calendar control then you need to use the ParseControl method to parse the result of the XSLT transformation into an ASP.NET conrol. That is the main suggestion I have made, to get that approach working at all. Whether you do that in your master page or not is up to you and not really an XSLT issue, more a question on how to build web applications with ASP.NET.





--
  Martin Honnen
  Microsoft MVP - XML
 
Old May 6th, 2008, 09:32 AM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

...which is fine. But I stated that my site uses a Master Page method that tranforms the XML/XSL differently than you had suggested on the post from "05/05/2008 : 10:17:38 AM" on this thread, and I asked if you could let me know how I could use ParseControl method within my setup. I also posted the code for how my site's set up on the post from "05/05/2008 : 2:30:03 PM".

So is there a way to use the ParseControl method you suggested within my setup? I appreciate your help.

KWilliams
 
Old May 6th, 2008, 09:56 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Your master page has an asp:Xml control and code in the Page_Load handler to set properties of that control. Instead of that asp:Xml control put an asp:PlaceHolder control there and then in your Page_Load handler put the code I suggested:
Code:
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

  Dim proc As New XslCompiledTransform()
  proc.Load(Server.MapPath("XSLTFile1.xsl"))
  Dim writer As New StringWriter()
  proc.Transform(XmlReader.Create(Server.MapPath("XMLFile1.xml")), null, writer)
  P1.Controls.Add(Page.ParseControl(writer.ToString()))

End Sub
--
  Martin Honnen
  Microsoft MVP - XML
 
Old May 8th, 2008, 12:55 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

...thanks for the code.

How would I then call it from the XSLT doc?

KWilliams
 
Old May 8th, 2008, 03:43 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've found a great working solution at: http://incrementaldevelopment.com/xsltrick/parvez/

It uses XML and XSLT without the need for the ASP.NET calendar control. Thanks for your help.:)

KWilliams





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar Control in ASP.NET 2.0 midway11 ASP.NET 1.x and 2.0 Application Design 3 May 11th, 2007 05:26 PM
ASP.NET and XML/XSLT kwilliams ASP.NET 2.0 Basics 0 January 8th, 2007 01:03 PM
XML > XSLT and ASP.NET 2.0 bonekrusher XSLT 7 September 22nd, 2006 06:26 PM
ASP.NET Calendar Control Client Side Access rodmcleay ASP.NET 1.0 and 1.1 Basics 4 June 17th, 2005 11:45 PM
Calendar control for ASP.NET App mishi ASP.NET 1.x and 2.0 Application Design 2 April 10th, 2005 05:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.