Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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 February 21st, 2010, 02:56 PM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Default Putting html in xml data source?

I have an xml data source. I have a description field that has html data(a paypal button & dropdown list)in it
I replaced the < & > with $lt; and with $gt; tags

When I read the xml file the paypal button and ddl appear but they don't function. They are frozen.

My asp code that reads the data is shown below followed by the XML

I tried this change <%#Eval<Server.HTMLEncode(("Description"))%>
but it didn't solve the problem


<CODE>
<
asp:GridViewID="GridViewCategories"runat="server"AutoGenerateColumns="False"
AllowPaging="true"PageSize="10"DataSourceID="ObjectDataSourceCategories"BorderWidth="0"
BorderColor="white">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageID="Image1"CssClass="photo-border photo-float-left"runat="server"Width="90px"
Height="60px"ImageUrl='<%# "http://p2p.wrox.com/images/" + Eval("ImageUrl") %>'AlternateText='<%#Eval("ImageAltText")%>'/>
<b>
<asp:HyperLinkID="HyperLink2"runat="server"NavigateUrl='<%# "Items.aspx?catId=" + Eval("id") %>'>
<%# Eval("Title")%>
</asp:HyperLink>
</b>
<br/>
<%#Eval("Description")%>
<br/>
<br/>
<asp:HyperLinkID="HyperLink5"runat="server"ImageUrl="http://p2p.wrox.com/images/arrow.gif"NavigateUrl='<%# "Items.aspx?catId=" + Eval("id") %>'/>
<asp:HyperLinkID="HyperLink4"runat="server"NavigateUrl='<%# "Items.aspx?catId=" + Eval("id") %>'>
Read More
</asp:HyperLink>
<hr/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerSettingsMode="NumericFirstLast"Position="TopAndBottom"/>
</asp:GridView>
<CODE>


my xml is

<category>
<
id>c02</id>
<
visible>true</visible>
<
title>Flexibility, Contortion</title>
<
description>
&lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt;
&lt;input type="hidden" name="cmd" value="_s-xclick"/&gt;
&lt;input type="hidden" name="hosted_button_id" value="xxxxx"/&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;input type="hidden" name="on0" value="Number of Students"/&gt;Number of Students
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;select name="os0"&gt;
&lt;option value="2 - Total Price:"&gt;2 - Total Price: $60.00&lt;/option&gt;
&lt;option value="3 - Total Price:"&gt;3 - Total Price: $75.00&lt;/option&gt;
&lt;option value="4 - Total Price:"&gt;4 - Total Price: $100.00&lt;/option&gt;
&lt;/select&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;input type="hidden" name="currency_code" value="USD"/&gt;
&lt;input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"/&gt;
&lt;img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/&gt;
&lt;/form&gt;
</description>
<
imageUrl>cat02.jpg</imageUrl>
<
imageAltText></imageAltText>
<
parentCategoryId>NULL</parentCategoryId>
</
category>

Last edited by sg48; February 21st, 2010 at 03:44 PM..
 
Old February 22nd, 2010, 11:16 AM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Default Was able to solve problem myself

The solution, perhaps not the most elegant, was interesting to me so I will share it here.
I copied the html paypal button code (for each button) into my XML database.
Note that each button has form tags
Note-had to fix their buttons. the img and input tags didn't have closing tags
Next I escasped the < " > symbols by doing replacements &lt; &quot; &gt;
I then viewed the calling aspx page and got a resource not available error.
I did a View Source and realized that the html for the buttons was correct.
The translation from HTML to XML was not a problem after the escaping.
I then remembered that I had this problem before on the predecessor site.
So what I did was change my master page for this one page only to
a master page that doesn't have form tags- I just deleted them. All of the buttons work perfectly now (even
though the calling page is an aspx page), albeit one that uses a master page that doesn't have form tags.
Hope this helps someone with a similar problem.

Last edited by sg48; February 22nd, 2010 at 11:18 AM.. Reason: grammer





Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Source Tools to generate XML from SQL data ethanhunt XML 0 May 7th, 2008 02:55 PM
Problem in transferring data into html from xml. Somesh C# 0 February 7th, 2007 07:43 AM
Dynamic Data source with Native XML driver Nellie Crystal Reports 1 November 30th, 2006 11:42 AM
constructing a HTML table from xml data using xslt rameshnarayan XSLT 0 September 19th, 2005 06:53 AM
putting xml data in a html <table> rev XSLT 4 September 10th, 2003 08:49 AM





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