jean4spa
asked on
Simple Nested repeater
Hi,
I'm trying to create a simple nested repeater following the tutorial on ASP.NET> Nested Data Web Controls.
But I'm having problems. While executing I get an error System.NullReferenceExcept ion: Object reference not set to an instance of an object.
, In debugmode I see that ObjectDataSource2 = Nothing.
Can somebody give me advise how to take things further?
here is my code:
I'm trying to create a simple nested repeater following the tutorial on ASP.NET> Nested Data Web Controls.
But I'm having problems. While executing I get an error System.NullReferenceExcept
, In debugmode I see that ObjectDataSource2 = Nothing.
Can somebody give me advise how to take things further?
here is my code:
Protected Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem OrElse e.Item.ItemType = ListItemType.Item Then
Dim Rol As planning.aspnet_Roles_GetAllRolesRow = CType(CType(e.Item.DataItem, System.Data.DataRowView).Row, planning.aspnet_Roles_GetAllRolesRow)
ObjectDataSource2.SelectParameters("ApplicationName").DefaultValue = "MyApplication"
ObjectDataSource2.SelectParameters("RoleName").DefaultValue = Rol.RoleName.ToString
End If
End Sub
And in the actual page:
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="ObjectDataSource1">
<ItemTemplate>
<br /><br />
<asp:Label runat="server" Text='<%# Eval("RoleName") %>'></asp:Label>
<asp:Repeater ID="Repeater2" runat="server" DataSourceID="ObjectDataSource2">
<ItemTemplate >
<asp:Label runat="server" Text='<%# Eval("UserName") %>'></asp:Label><br />
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="planningTableAdapters.aspnet_Roles_GetAllRolesTableAdapter">
<SelectParameters>
<asp:Parameter DefaultValue="MyApplication" Name="ApplicationName"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="planningTableAdapters.aspnet_UsersInRoles_GetUsersInRolesTableAdapter">
<SelectParameters>
<asp:Parameter DefaultValue="MyApplication" Name="ApplicationName"
Type="String" />
<asp:Parameter DefaultValue="" Name="RoleName" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER