473,513 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nested Repeater Question

Hi,

I have a nested repeater and this is the code I have in the item data bound
event

private void _repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
RepeaterItem rItem = e.Item;
DataRowView drv = (DataRowView) rItem.DataItem;
..........
.........
But when I complile I get an error that specified case is not valid (for
DataRowView).

Any help?

Jun 27 '06 #1
2 980

if you do it ... the other way... does it crap on you?

DataRowView drv = rItem.DataItem as DataRowView;
if(null!=drv)
{
//it actually was a DataRowView item.
}

I"m not sure on a repeater, but isnt there a e.RowType or something? (im
thinking of a GridView, where there is HeaderRow(type) and ItemRowType.

...

I'm going from memory... so don't put too much hope in my post.

"mavrick_101" <ma********@discussions.microsoft.com> wrote in message
news:4A**********************************@microsof t.com...
Hi,

I have a nested repeater and this is the code I have in the item data bound event

private void _repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) {
RepeaterItem rItem = e.Item;
DataRowView drv = (DataRowView) rItem.DataItem;
.........
........
But when I complile I get an error that specified case is not valid (for
DataRowView).

Any help?

Jun 27 '06 #2
The casting you are doing is based on the DataSource you have assigned
to the Repeater control.

In case of a DataTable is assigned to the Repeater.DataSource then you
can write a code similar like below,

private void _repeater1_ItemDataBound(object sender,
RepeaterItemEventArgs e)
{

RepeaterItem rItem = e.Item;
DataRow drv = (DataRow) rItem.DataItem;
...
}

If this doesn't help, put a debug mark inside this method and check the
type of "rItem.DataItem" using "Immediate Window" or "Quick Watch"
window. You can even see the data present in the DataItem object. Based
on that cast the "rItem.DataItem", It should work.

-
Vadivel Kumar
http://vadivelk.net

mavrick_101 wrote:
Hi,

I have a nested repeater and this is the code I have in the item data bound
event

private void _repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
RepeaterItem rItem = e.Item;
DataRowView drv = (DataRowView) rItem.DataItem;
.........
........
But when I complile I get an error that specified case is not valid (for
DataRowView).

Any help?

Jun 28 '06 #3

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

Similar topics

0
1748
by: mark | last post by:
My problem is I need to have a "nested" repeater. I have an array which I load into a hashtable - that part works great. I can setup the second repeater to work just fine, as long as it's not...
1
3146
by: Bojesphob | last post by:
Can someone help? I have a nested repeater in which I wish to format one of the bits of data in currency. I know that the code for the regular repeater (which works fine in parent) is...
0
5385
by: Ed Allan | last post by:
http://ejaconsulting.com/nestedrepeater/NestedRepeater.txt >-----Original Message----- >Doh! The HTML has all been rendered . . . > >Right click on this link and select 'Save target as ..' >to...
1
1694
by: Maziar Aflatoun | last post by:
Hi, I have tried setting up a nested repeater control and it works fine. But when I do 3 level nested repeater it fails. Does anyone know a site or have an example of a three level nestest...
1
1293
by: humbleFunGuy | last post by:
What does nested controls mean in .Net? Any help is appreciated. Thanks, fanzi
2
1898
by: mark | last post by:
(not sure if this is the correct group) My problem is I need to have a "nested" repeater. I have an array which I load into a hashtable - that part works great. I can setup the second repeater...
2
4253
by: Allan Ebdrup | last post by:
Hi, I'm trying to render a Matrix question in my ASP.Net 2.0 page, A matrix question is a question where you have several options that can all be rated according to several possible ratings (from...
4
4545
by: =?Utf-8?B?SmFtZXMgR2V1cnRz?= | last post by:
On my page, I have one repeater that contains a literal control and a nested repeater. The nested repeater contains a literal control. Both repeaters are databound with only one object (string). ...
1
1860
by: andrew.douglas11 | last post by:
Hello all, Is it possible to share controls inside a child repeater? Here's the situation: I have a web page that needs to display data grouped by A, and alternatively by B (only one grouping...
2
2589
by: ASF | last post by:
Hey all, I have a gridview which pulls from a BLL which pulls from a DAL (an .XSD file). Each row on that gridview has a nested repeater which pulls from another table. The code which populates...
0
7269
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,...
0
7177
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...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
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...
0
5701
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,...
0
4756
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...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
811
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.