开发者

ComponentOne : C1NavigationList databinding with XMLDataSource

In the process of Iphone View ability for a shopping cart system, where i am trying to implement using the ComponentOne tools for Iphone in the products listing.For which i have identified C1NavigationList control for the same.

As i understand it is a Hierarchical data control, i am binding it to an XML DataSource, as i don't need any sub items but a collection of main items where the details as attributes of the XML node as below:

ComponentOne : C1NavigationList databinding with XMLDataSource

Requirement: I would like to define a layout in the C1Navigation list template and XPath bind the data as in the given screen grab above.

Given below is the code which i have tried to do but failed.It throws me the error :"Databinding methods such as Eval(), XPath(), and Bind() can only be used in the...."

What am i doing wrong?.Please advice me.

<asp:XmlDataSource ID="XmlDataSource1" runat="server" XPath="/NewDataSet/_x0028__x0028"

DataF开发者_如何学Cile="~/App_Data/Copy of Coffee____1__0__0_0_d.xml">

<C1NavigationList:C1NavigationList ID="C1NavigationList1" 
  runat="server" DataSourceID="XmlDataSource1" Text="XMLDataSource"   NavigationListType="RoundedCornersList" TrackItemsStructure="false">

<%# XPath("@item_smkt_desc")%>


I would use a for loop to do this instead of XmlDataSource. Then you have more control over the UI anyways. I have used this method quite a bit successfully. Here is how I would write you code:

System.Xml.Linq.XElement xEle = System.Xml.Linq.XElement.Load(Server.MapPath("~/App_Data/Copy of Coffee___1_0__0_0_d.xml"));
var items = from c in xEle.Elements("NewDataSet") select c;
foreach (System.Xml.Linq.XElement ele in items)
{
    C1.Web.iPhone.C1NavigationList.C1NavigationListItem li = new C1.Web.iPhone.C1NavigationList.C1NavigationListItem();
    li.Text = ele.Attribute("item_smkt_desc");
    C1NavigationList1.Items.Add(li);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜