473,383 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Repeater control -- Using e.Item.DataItem

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.XmlDataSourceNodeDescrip tor, 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

May 10 '06 #1
2 5583
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.XmlDataSourceNodeDescrip tor, 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

May 10 '06 #2
Eric,

Excellent job.

Thanks

DB

"Eric" <Er**@discussions.microsoft.com> wrote in message
news:D0**********************************@microsof t.com...
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.XmlDataSourceNodeDescrip tor, 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

May 10 '06 #3

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

Similar topics

2
by: Stan | last post by:
I cannot make the link buttons fire ItemCommand from repeater control. Here is the code: <asp:repeater id=rptLetters runat="server"> <itemtemplate> <asp:linkbutton id="lnkLetter"...
2
by: Imran Aziz | last post by:
Hello All, Is there a way to delete rows from a repeater control using any build in features? Imran.
5
by: Imran Aziz | last post by:
Hello all, I am populating the contents of a repeater control using a database query. In the repeater control I have a link , which I want to display or not based on the current logged in user....
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
4
by: sck10 | last post by:
Hello, I have a repeater that is bound to a SQL Server table. I would like to place a summary in the footer for the item count and product cost. I have two fields. One for the product name...
5
by: Howard | last post by:
i have this repeater control <asp:Repeater runat="server" ID="Repeater1"> <ItemTemplate> <span><%# Eval("text")%></span>< br/> </ItemTemplate> </asp:Repeater> it generates something like this...
0
by: Keith | last post by:
I have a repeater control that contains a HeaderTemplate and an ItemTemplate. Each item contains a checkbox with an ID of chkReconciled, and the header contains a single checkbox with an ID of...
1
by: =?Utf-8?B?R3V1czEyMw==?= | last post by:
Hi, I just converted my asp.net app to vs2005 and now developing using vista and run into a problem using the repeater control. I bind the repeater control using If Not IsPostBack Then...
0
by: rameshonweb | last post by:
Does any one has a good site or code for sorting by repeater control using session state?.Thanks in advance
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.