Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 6th, 2006, 01:42 PM
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating Dynamic ASP.NET Server Controls Using XML

I'm following a great article titled "Creating Dynamic ASP.NET Server Controls Using XML" at http://www.devarticles.com/c/a/ASP.N...s-Using-XML/2/, but I'm running into strange problems when I attempt to re-produce the pages.

Basically, the ASP.NET server controls show up in the code, but they aren't being displayed on the page. The method I'm using involves XML/XSLT transformation on an ASP.NET page, but I've also tried just attaching the XSLT stylesheet to the XML doc to no avail.

So I've included the code that I'm using at the bottom of this post. If anyone can help me to figure out what I'm doing wrong, I'd appreciate it. Thanks.

<?xml version="1.0" encoding="UTF-8"?>
    <survey name="Example Survey">
        <question type="text" name="Title" required="yes"/>
        <question type="text" name="Industry"/>
        <question type="radio" name="Education">
        <choice>High school</choice>
        <choice>Some college</choice>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="remove">
<xsl:output method="xml" indent="yes" encoding="utf-8" omit-xml-declaration="yes"/>
<xsl:template match="/">
    <div id="content">
        <xsl:for-each select="//question">
                <td valign="top"><xsl:value-of select="@name" />
                <xsl:if test="@required = 'yes'">
                    <asp:RequiredFieldValidator ErrorMessage="RequiredField" runat="server" ControlToValidate="{@name}" />
                <xsl:if test="@type='text'">
                    <asp:TextBox id="{@name}" runat="server" />
                <xsl:if test="@type='radio'">
                    <asp:RadioButtonList id="{@name}" runat="server">
                        <xsl:for-each select="choice">
                            <asp:ListItem Value="{@value}"><xsl:value-of select="@value"/></asp:ListItem>
    <asp:button id="submit" runat="server" Text="Submit" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <form name="_ctl1" method="post" action="index.aspx?page=test" id="_ctl1">
    <input type="hidden" name="__VIEWSTATE" value="dDw5OTQ1Mjc4NDc7dDw7bDxpPDE+O2k8Mz47PjtsPHQ8O2w8aTwxPjtpPDM+O2k8Nz47aTw5PjtpPDExPjs+O2w8dDxwPGw8aW5uZXJodG1sOz47bDxEb3VnbGFzIENvdW50eSwgS2Fuc2FzIC0gRmVlZGJhY2sgRm9ybSBURVNUOz4+Ozs+O3Q8cDxsPGhyZWY7PjtsPC9uZXdzaXRlL2RvY3MvY3NzL2dlY2tvLmNzczs+Pjs7Pjt0PHA8bDxjb250ZW50Oz47bDxcZTs+Pjs7Pjt0PHA8bDxjb250ZW50Oz47bDxcZTs+Pjs7Pjt0PHA8bDxjb250ZW50Oz47bDxGcmlkYXksIE9jdG9iZXIgMDYsIDIwMDY7Pj47Oz47Pj47dDw7bDxpPDE+Oz47bDx0PHA8cDxsPFRleHQ7PjtsPEZyaWRheSwgT2N0b2JlciAwNiwgMjAwNjs+Pjs+Ozs+Oz4+Oz4+Oz7sPS4LQzwPyQo7LC8Hr0V7L8jzTw==" />

            <?xml version="1.0" encoding="iso-8859-1"?>
            <div id="content" xmlns:asp="remove">
                                    <td valign="top">Title<asp:RequiredFieldValidator ErrorMessage="RequiredField" runat="server" ControlToValidate="Title" /></td>
                                                <asp:TextBox id="Title" runat="server" />
                                    <td valign="top">Industry</td>
                                                <asp:TextBox id="Industry" runat="server" />

                                    <td valign="top">Education</td>
                                    <asp:RadioButtonList id="Education" runat="server">
                                                <asp:ListItem Value=""></asp:ListItem>
                                                <asp:ListItem Value=""></asp:ListItem>
                                                <asp:ListItem Value=""></asp:ListItem>
            <asp:button id="submit" runat="server" Text="Submit" />
DISPLAY OUTPUT (just text shows up):

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
problems in creating dynamic controls merinmathew ASP.NET 1.0 and 1.1 Basics 0 January 12th, 2006 01:06 AM
Dynamic generation of asp.net server controls shashi1312 Classic ASP XML 1 August 2nd, 2005 04:52 AM
Creating Dynamic Forms with ASP.NET saturdave ASP.NET 1.0 and 1.1 Basics 5 November 23rd, 2004 06:10 PM
Dynamic generation of controls in ASP.NET Maxood ASP.NET 1.0 and 1.1 Basics 2 March 8th, 2004 07:29 PM

All times are GMT -4. The time now is 03:44 AM.

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