newbie: ItemDataBound and XPath

Discussion in 'ASP .Net' started by Jeff, Aug 3, 2006.

  1. Jeff

    Jeff Guest

    hey

    asp.net 2.0

    I have a DataList which has a XmlDataSource as its data source.

    This code crash because I use XPath in the ItemDataBound event:
    protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs
    e)
    {
    Label label = (Label)e.Item.FindControl("lblTitle");
    label.Text = XPath("title").ToString();
    label = (Label)e.Item.FindControl("lblStory");
    label.Text = XPath("description").ToString();
    }

    Any suggestion how this should be done in a ItemDataBound event?

    Jeff
     
    Jeff, Aug 3, 2006
    #1
    1. Advertising

  2. Jeff

    Jeff Guest

    CASE SOLVED

    "Jeff" <> wrote in message
    news:eCAL$...
    > hey
    >
    > asp.net 2.0
    >
    > I have a DataList which has a XmlDataSource as its data source.
    >
    > This code crash because I use XPath in the ItemDataBound event:
    > protected void DataList1_ItemDataBound(object sender,
    > DataListItemEventArgs e)
    > {
    > Label label = (Label)e.Item.FindControl("lblTitle");
    > label.Text = XPath("title").ToString();
    > label = (Label)e.Item.FindControl("lblStory");
    > label.Text = XPath("description").ToString();
    > }
    >
    > Any suggestion how this should be done in a ItemDataBound event?
    >
    > Jeff
    >
     
    Jeff, Aug 3, 2006
    #2
    1. Advertising

  3. Jeff look at this sample here at:-
    http://www.thescripts.com/forum/thread467894.html
    Patrick

    "Jeff" <> wrote in message
    news:eCAL$...
    > hey
    >
    > asp.net 2.0
    >
    > I have a DataList which has a XmlDataSource as its data source.
    >
    > This code crash because I use XPath in the ItemDataBound event:
    > protected void DataList1_ItemDataBound(object sender,
    > DataListItemEventArgs e)
    > {
    > Label label = (Label)e.Item.FindControl("lblTitle");
    > label.Text = XPath("title").ToString();
    > label = (Label)e.Item.FindControl("lblStory");
    > label.Text = XPath("description").ToString();
    > }
    >
    > Any suggestion how this should be done in a ItemDataBound event?
    >
    > Jeff
    >
     
    Patrick.O.Ige, Aug 3, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marvin_123456

    "Memory leak" in javax.xml.xpath.XPath

    Marvin_123456, Jul 29, 2005, in forum: Java
    Replies:
    4
    Views:
    1,974
    jan V
    Jul 29, 2005
  2. Alastair Cameron
    Replies:
    1
    Views:
    7,415
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  3. Anna
    Replies:
    0
    Views:
    526
  4. goog
    Replies:
    0
    Views:
    508
  5. Tjerk Wolterink

    XPath: efficiency in xpath expressions

    Tjerk Wolterink, Nov 13, 2004, in forum: XML
    Replies:
    1
    Views:
    1,641
    Richard Tobin
    Nov 13, 2004
Loading...

Share This Page