Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple repeaters in one page

Status
Not open for further replies.

jermine

Programmer
Jun 15, 2001
59
SG
hello to the .NET gurus out there.
i hope you guys can help me on this.
Thanks in advance!

my page have two repeaters, diplaying different sets of data.

repeater 1 is bound to DataTable A and
repeater 2 is bound to DataTable B.

Displaying values for repeater with the code for repeater 1 is ok :
<%# DataBinder.Eval(Container.DataItem, "field from DataTable A")%>

but when i tried displaying data from DataTable B with :
<%# DataBinder.Eval(Container.DataItem, "field from DataTable B")%>

i get the error message :
Exception Details: System.Web.HttpException: DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name [field from DataTable B]


 
If you remove the first data repeater would the second one run OK?


Note:Copying and Pasting is NoT Creativity.
What would you attempt to accomplish if you knew you would not fail?
 
did you define a relationship between the tables? are your tables related some way thats why you need a nested repeater?



Note:Copying and Pasting is NoT Creativity.
What would you attempt to accomplish if you knew you would not fail?
 
can you post the code for the aspx page that includes both repeaters?


Note:Copying and Pasting is NoT Creativity.
What would you attempt to accomplish if you knew you would not fail?
 
this is for the first repeater,
Code:
<asp:repeater id="repRoomsofMeeting" runat="server">
 <ItemTemplate>
 <tr>
    <td>
	<asp:Label ID="txtRoom" Runat="server">
	<%# DataBinder.Eval(Container.DataItem, "Room")%>
	</asp:Label>
    </td>
    </tr>
 </ItemTemplate>
 <Headertemplate>
   <table border="0" width="100%">
 </Headertemplate>
 <FooterTemplate>
   </table>
 </FooterTemplate> 
</asp:repeater>
this is for the 2nd repeater,
Code:
<asp:repeater id="repAttendeesofMeeting" runat="server">
 <ItemTemplate>
 <tr>
    <td>
	<asp:Label ID="txtAttendee" Runat="server">
	<%# DataBinder.Eval(Container.DataItem, "Attendee")%>
	</asp:Label>
    </td>
    </tr>
 </ItemTemplate>
 <Headertemplate>
   <table border="0" width="100%">
 </Headertemplate>
 <FooterTemplate>
   </table>
 </FooterTemplate> 
</asp:repeater>

And now the code behind for both :
Code:
public void getRoomsofMeeting(DataTable dtRoom)
{
  repRoomsofMeeting.DataSource=dtRoom;
  repRoomsofMeeting.DataBind();
}

public void getAttendeesofMeeting(DataTable dtAttendees)
{
  repAttendeesofMeeting.DataSource= dtAttendees;
  repRoomsofMeeting.DataBind();
}
 
This is just a late-night stab in the dark, but could it be a mispelling of the column name? Sounds like the repeater is looking for a column that isn't present (maybe the database has a column named atendees instead of attendees or something along those lines?), or could it possibly be an issue with your select statement? Are you selecting that column (if you're doing a select * then it shouldn't be a problem)...

Like I said - late night stab in the dark, but wouldn't it be nice if that was the problem? ;)

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Thats what i thought when i asked him/her if the repeaters work and the answer was yes
i created 2 arrays and bound them to 2 repeaters and the code posted works just fine



Note:Copying and Pasting is NoT Creativity.
What would you attempt to accomplish if you knew you would not fail?
 
Thanks guys!! the idea worked...
i guess i was really tired already.. just overlooked the field names :)

Ecreations , AtomicChip, kudos to both of you!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top