Repeater control -- Using e.Item.DataItem

Discussion in 'ASP .Net' started by =?Utf-8?B?RXJpYw==?=, May 10, 2006.

  1. Hello,

    I have a repeater control bound to an XmlDataSource. Works great.

    Now, I want to handle the ItemDataBound event--the e.Item.DataItem object in
    particular. Its type is
    System.Web.UI.WebControls.XmlDataSourceNodeDescriptor, which contains the
    XmlNode needed to reference the data.

    The problem is that _node is a private member of the
    XmlDataSourceNodeDescriptor, and it is sealed, so I can't inherit it.
    Doesn't it seem rather useless to embed all the data in the class, then hide
    it from run-time view? It drives me crazy that I can view everything while
    debugging by drilling down into the "non-public members", but you can't
    programmatically access that.

    Has anyone been able to use the XmlDataSourceNodeDescriptor object, or at
    least reference XML nodes within the e.Item.DataItem object?

    Thank you,

    Eric
    =?Utf-8?B?RXJpYw==?=, May 10, 2006
    #1
    1. Advertising

  2. Found it!

    I dissassembled the XmlDataSourceNodeDescriptor class and found that it
    inherits from IXPathNavigable, so this code works (within the ItemDataBound
    event):

    XPathNavigator nav = ((IXPathNavigable)e.Item.DataItem).CreateNavigator();
    myLabel.Text = nav.SelectSingleNode("myElement").Value;

    I couldn't find ANY info about XmlDataSourceNodeDescriptor on MSDN, so
    hopefully this helps somebody!

    Eric


    "Eric" wrote:

    > Hello,
    >
    > I have a repeater control bound to an XmlDataSource. Works great.
    >
    > Now, I want to handle the ItemDataBound event--the e.Item.DataItem object in
    > particular. Its type is
    > System.Web.UI.WebControls.XmlDataSourceNodeDescriptor, which contains the
    > XmlNode needed to reference the data.
    >
    > The problem is that _node is a private member of the
    > XmlDataSourceNodeDescriptor, and it is sealed, so I can't inherit it.
    > Doesn't it seem rather useless to embed all the data in the class, then hide
    > it from run-time view? It drives me crazy that I can view everything while
    > debugging by drilling down into the "non-public members", but you can't
    > programmatically access that.
    >
    > Has anyone been able to use the XmlDataSourceNodeDescriptor object, or at
    > least reference XML nodes within the e.Item.DataItem object?
    >
    > Thank you,
    >
    > Eric
    >
    =?Utf-8?B?RXJpYw==?=, May 10, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?RXJpYw==?=

    Dumbell Guest

    Eric,

    Excellent job.

    Thanks

    DB

    "Eric" <> wrote in message
    news:D...
    > Found it!
    >
    > I dissassembled the XmlDataSourceNodeDescriptor class and found that it
    > inherits from IXPathNavigable, so this code works (within the
    > ItemDataBound
    > event):
    >
    > XPathNavigator nav = ((IXPathNavigable)e.Item.DataItem).CreateNavigator();
    > myLabel.Text = nav.SelectSingleNode("myElement").Value;
    >
    > I couldn't find ANY info about XmlDataSourceNodeDescriptor on MSDN, so
    > hopefully this helps somebody!
    >
    > Eric
    >
    >
    > "Eric" wrote:
    >
    >> Hello,
    >>
    >> I have a repeater control bound to an XmlDataSource. Works great.
    >>
    >> Now, I want to handle the ItemDataBound event--the e.Item.DataItem object
    >> in
    >> particular. Its type is
    >> System.Web.UI.WebControls.XmlDataSourceNodeDescriptor, which contains the
    >> XmlNode needed to reference the data.
    >>
    >> The problem is that _node is a private member of the
    >> XmlDataSourceNodeDescriptor, and it is sealed, so I can't inherit it.
    >> Doesn't it seem rather useless to embed all the data in the class, then
    >> hide
    >> it from run-time view? It drives me crazy that I can view everything
    >> while
    >> debugging by drilling down into the "non-public members", but you can't
    >> programmatically access that.
    >>
    >> Has anyone been able to use the XmlDataSourceNodeDescriptor object, or at
    >> least reference XML nodes within the e.Item.DataItem object?
    >>
    >> Thank you,
    >>
    >> Eric
    >>
    Dumbell, May 11, 2006
    #3
  4. =?Utf-8?B?RXJpYw==?=

    ichi27

    Joined:
    Jun 2, 2011
    Messages:
    2
    Yessss! had to register just to thank u.. this was totally ****ing me for hte last hour !
    ichi27, Jun 2, 2011
    #4
  5. =?Utf-8?B?RXJpYw==?=

    ichi27

    Joined:
    Jun 2, 2011
    Messages:
    2
    hey how'd u guys stay guests lol Damit!
    ichi27, Jun 2, 2011
    #5
    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. Kel Good
    Replies:
    2
    Views:
    13,060
    Kel Good
    Apr 25, 2004
  2. Peter Rilling
    Replies:
    1
    Views:
    999
    =?Utf-8?B?RWx0b24gVw==?=
    May 19, 2005
  3. Dave Adams

    Repeater e.item.dataitem null on postback

    Dave Adams, Oct 13, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    448
    Dave Adams
    Oct 13, 2003
  4. Chumley the Walrus

    How do I assign a variable to a container.dataitem in repeater control

    Chumley the Walrus, May 12, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    313
    Chumley the Walrus
    May 12, 2004
  5. sgh
    Replies:
    2
    Views:
    2,163
    Weston Weems
    Dec 1, 2004
Loading...

Share This Page