473,587 Members | 2,547 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_Item DataBound(objec t sender, RepeaterItemEve ntArgs 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 984

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_10 1" <ma********@dis cussions.micros oft.com> wrote in message
news:4A******** *************** ***********@mic rosoft.com...
Hi,

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

private void _repeater1_Item DataBound(objec t sender, RepeaterItemEve ntArgs 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.DataSo urce then you
can write a code similar like below,

private void _repeater1_Item DataBound(objec t sender,
RepeaterItemEve ntArgs 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_Item DataBound(objec t sender, RepeaterItemEve ntArgs 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
1755
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 nested within the first repeater. If it is nested within the first repeater, I don't get any data. If I put the second repeater as a separate repeater,...
1
3151
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 databinder.eval(Container.DataItem, "Net", "{0:c}") . BUT I use that code in the nested repeater and IT DOES NOT WORK!!!! In that code I have DataBinder.Eval...
0
5392
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 get the code in a text file. > >Thanks - Ed >
1
1699
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 repeater control? Where there is a parent repeater inside it there is a child repeater and inside that child repeater there is another child repeater? ...
1
1298
by: humbleFunGuy | last post by:
What does nested controls mean in .Net? Any help is appreciated. Thanks, fanzi
2
1902
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 to work just fine, as long as it's not nested within the first repeater. If it is nested within the first repeater, I don't get any data. If I put...
2
4265
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 less to more for example). I have a question object that has two properties that contain the collections Options and Ratings. now I want this kind...
4
4555
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). But... and this is the crappy part, the nested repeater's events are fired twice. How do I know this? I setup global private counter variables...
1
1863
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 displayed at a time through Panel.Visible). A and B both share common child data: C. I have 2 parent repeaters corresponding to A and B, and each...
2
2597
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 each nested repeater is shown below (it's in the gridview's RowDataBound event). My question is this: what can I do to speed up this process?...
0
7849
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8215
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6626
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.