473,769 Members | 8,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems binding propertyless class to a Repeater

I am digesting a web serivce from Amazon.Com. I have the following
class which was autogenerated by VS.NET when I created a Web Reference
to http://webservices.amazon.com/AWSECo...ceService.wsdl

AmazonWebServic e.com.amazon.we bservices.Item

As you can see from the code snippets below it has public member
variables rather than public Properties. When I use <%#
DataBinder.Eval (Container.Data Item, "ASIN") %> syntax in Repeater1 in
my aspx page I get the following error.

[HttpException (0x80004005): DataBinder.Eval :
'AmazonWebServi ce.com.amazon.w ebservices.Item ' does not contain a
property with the name ASIN.]
System.Web.UI.D ataBinder.GetPr opertyValue(Obj ect container, String
propName)
System.Web.UI.D ataBinder.Eval( Object container, String[]
expressionParts )
System.Web.UI.D ataBinder.Eval( Object container, String expression)
ASP.SearchForm_ aspx.__DataBind __control8(Obje ct sender, EventArgs e)
in c:\inetpub\wwwr oot\AmazonWebSe rvice\SearchFor m.aspx:33
System.Web.UI.C ontrol.OnDataBi nding(EventArgs e)
System.Web.UI.C ontrol.DataBind ()
System.Web.UI.C ontrol.DataBind ()
System.Web.UI.W ebControls.Repe ater.CreateItem (Int32 itemIndex,
ListItemType itemType, Boolean dataBind, Object dataItem)
System.Web.UI.W ebControls.Repe ater.CreateCont rolHierarchy(Bo olean
useDataSource)
System.Web.UI.W ebControls.Repe ater.OnDataBind ing(EventArgs e)
System.Web.UI.W ebControls.Repe ater.DataBind()
AmazonWebServic e.Web.SearchFor m.Button1_Click (Object sender, EventArgs
e) in c:\inetpub\wwwr oot\amazonwebse rvice\searchfor m.aspx.cs:83
System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()

If I add a property to the Item class called ASINP, which encapsulates
ASIN member variable, and I use <%#
DataBinder.Eval (Container.Data Item, "ASINP") %> syntax in Repeater1 on
my aspx then everything works fine. Since the Item class is
autogenerated I do not want to have to add Properties in every
autogenerated class because I have about 40 auto generated classes.
How can I reference the memeber variable ASIN in the aspx page, or any
other memeber variable in that class.

Please see the code snippets below if you have questions.

Thanks,
Chris Gastin

CODE SNIPPETS:
////////////////////////////////////////////////////////////////////////////////////////////////////
// asp:Repeater
///////////////////////////////////////////////////////////////////////////////////////////////////
<asp:Repeater id="Repeater1" runat="server">
<HeaderTemplate >
<table border=1>
<tr>
<td>Results:</td>
</tr>
</HeaderTemplate>
<ItemTemplate >
<tr>
<td bgcolor="LightG rey">
<%# DataBinder.Eval (Container.Data Item, "ASIN") %>
</td>
</tr>
</ItemTemplate>
<AlternatingIte mTemplate>
<tr>
<td bgcolor="Yellow ">
<%# DataBinder.Eval (Container.Data Item, "ASIN") %>
</td>
</tr>
</AlternatingItem Template>
<FooterTemplate >
</table>
</FooterTemplate>
</asp:Repeater>


////////////////////////////////////////////////////////////////////////////////////////////////////
// Button Click Event
///////////////////////////////////////////////////////////////////////////////////////////////////
private void Button1_Click(o bject sender, System.EventArg s e)
{
AWSECommerceSer vice svc = new AWSECommerceSer vice();
ItemSearchReque st itemSearchReque st = new ItemSearchReque st();
itemSearchReque st.Keywords = TextBox1.Text;
itemSearchReque st.SearchIndex = DropDownList1.S electedValue;
itemSearchReque st.MerchantId = "All";
itemSearchReque st.ResponseGrou p = new string[]{"Large"};
ItemSearch search = new ItemSearch();
search.Subscrip tionId =
ConfigurationSe ttings.AppSetti ngs["SubscriptionId "];
search.Request = new ItemSearchReque st[]{itemSearchRequ est};
IAsyncResult result = svc.BeginItemSe arch(search,nul l,null);
ItemSearchRespo nse searchResponse = svc.EndItemSear ch(result);

Repeater1.DataS ource = searchResponse. Items[0].Item;
Repeater1.DataB ind();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Item Class
///////////////////////////////////////////////////////////////////////////////////////////////////

/// <remarks/>
[System.Xml.Seri alization.XmlTy peAttribute(Nam espace="http://webservices.ama zon.com/AWSECommerceSer vice/2004-10-19")]
public class Item {

/// <remarks/>
public string ASIN;

/// <remarks/>
[System.Xml.Seri alization.XmlAr rayItemAttribut e("Error",
IsNullable=fals e)]
public ErrorsError[] Errors;

/// <remarks/>
public string DetailPageURL;

/// <remarks/>
public string SalesRank;

/// <remarks/>
public Image SmallImage;

/// <remarks/>
public Image MediumImage;

/// <remarks/>
public Image LargeImage;

/// <remarks/>
public ItemAttributes ItemAttributes;

/// <remarks/>
public OfferSummary OfferSummary;

/// <remarks/>
public Offers Offers;

/// <remarks/>
public VariationSummar y VariationSummar y;

/// <remarks/>
public Variations Variations;

/// <remarks/>
public CustomerReviews CustomerReviews ;

/// <remarks/>
[System.Xml.Seri alization.XmlAr rayItemAttribut e("EditorialRev iew",
IsNullable=fals e)]
public string[] EditorialReview s;

/// <remarks/>
[System.Xml.Seri alization.XmlAr rayItemAttribut e("SimilarProdu ct",
IsNullable=fals e)]
public SimilarProducts SimilarProduct[] SimilarProducts ;

/// <remarks/>
[System.Xml.Seri alization.XmlAr rayItemAttribut e("SimilarBusin ess",
IsNullable=fals e)]
public SimilarBusiness esSimilarBusine ss[] SimilarBusiness es;

/// <remarks/>
[System.Xml.Seri alization.XmlAr rayItemAttribut e("Accessory" ,
IsNullable=fals e)]
public AccessoriesAcce ssory[] Accessories;

/// <remarks/>
[System.Xml.Seri alization.XmlAr rayItemAttribut e("Disc",
IsNullable=fals e)]
public TracksDisc[] Tracks;

/// <remarks/>
public BrowseNodes BrowseNodes;

/// <remarks/>
[System.Xml.Seri alization.XmlAr rayItemAttribut e("ListmaniaLis t",
IsNullable=fals e)]
public ListmaniaListsL istmaniaList[] ListmaniaLists;

/// <remarks/>
public SearchInside SearchInside;

/// <remarks/>
public PromotionalTag PromotionalTag;
}
Nov 16 '05 #1
0 1464

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1974
by: Paul K | last post by:
I'm having a problem getting the data binding to work with the repeater control. Here's the code for the code-behind class private void Page_Load(object sender, System.EventArgs e if (!this.IsPostBack DataView dv = new DataView(AlbumMgr.Instance.GetAlbumsList()) rptalbums.DataSource = dv rptalbums.DataBind()
2
2316
by: Gastin | last post by:
I am consuming a web serivce from Amazon.Com. I have the following class which was autogenerated by VS.NET when I created a Web Reference to http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl AmazonWebService.com.amazon.webservices.Item As you can see from the code snippets below it has public member variables rather than public Properties. When I use <%# DataBinder.Eval(Container.DataItem, "ASIN") %> syntax in...
12
2181
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm doing a web app in VB/Dot Net 2.0. I'm probably a bit rusty and I have no experience using the repeater control. I have a user control I've created with multiple properties. I've created a test page and I've managed to bind the usercontrol to a repeater and display some data in the following fashion: <asp:Repeater ID="Repeater1" runat="server" DataSourceID="ObjectDataSource1"> <ItemTemplate > <uc1:AUserControl runat="server"...
1
3557
markrawlingson
by: markrawlingson | last post by:
Hello, For starters: Yes, I am new to asp.net, however I hold a good 9-10 years of experience working with classic asp and am only just now upgrading my skills. I'm picking asp.net up pretty quickly but I'm running into a stumbling block that I just can't seem to get around. I think I know what the problem is, and I'm pretty confident in a work around, but it's not quite what I had hoped for so I thought I'd pick some of the experts brains...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3567
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.