K
Kevin Humphreys
Hi,
I am trying to show and hide different panels in a row of a repeater pending
on the record that is returned.
Inside in the <ItemTemplate> I have a number of Panels and a function called
ShowPanel.
If the field "Panel" returns Panel1 then I was to show Panel1 and hide
Panel2, Panel3 and Panel 4.
If the field "Panel" returns Panel2 then I was to show Panel2 and hide
Panel1, Panel3 and Panel 4 etc.
<asp:repeater id="Repeater1" runat="server">
<ItemTemplate>
<div id='d<%# DataBinder.Eval(Container, "ItemIndex") %>' class="details">
<aspanel id="Panel1" runat="server">Panel1</aspanel>
<aspanel id="Panel2" runat="server">Panel2</aspanel>
<aspanel id="Panel3" runat="server">Panel3</aspanel>
<aspanel id="Panel4" runat="server">Panel4</aspanel>
<%# ShowPanel(Container.DataItem("Panel")) %>
</div>
</ItemTemplate>
</asp:repeater>
The ShowPanel funciton is as follows
Public Function ShowPanel(ByVal gender As String) As String
Select Case gender
Case "Panel1"
Panel1.Visible = True
Panel2.Visible = False
Panel3.Visible = False
Panel4.Visible = False
Case "Panel2"
etc...
End Select
Return Nothing
End Function
However when I do this I get the following error message
"System.NullReferenceException: Object reference not set to an instance of
an object."
Any ideas?
You help is much appreciated.
Regards,
Kevin Humphreys.
I am trying to show and hide different panels in a row of a repeater pending
on the record that is returned.
Inside in the <ItemTemplate> I have a number of Panels and a function called
ShowPanel.
If the field "Panel" returns Panel1 then I was to show Panel1 and hide
Panel2, Panel3 and Panel 4.
If the field "Panel" returns Panel2 then I was to show Panel2 and hide
Panel1, Panel3 and Panel 4 etc.
<asp:repeater id="Repeater1" runat="server">
<ItemTemplate>
<div id='d<%# DataBinder.Eval(Container, "ItemIndex") %>' class="details">
<aspanel id="Panel1" runat="server">Panel1</aspanel>
<aspanel id="Panel2" runat="server">Panel2</aspanel>
<aspanel id="Panel3" runat="server">Panel3</aspanel>
<aspanel id="Panel4" runat="server">Panel4</aspanel>
<%# ShowPanel(Container.DataItem("Panel")) %>
</div>
</ItemTemplate>
</asp:repeater>
The ShowPanel funciton is as follows
Public Function ShowPanel(ByVal gender As String) As String
Select Case gender
Case "Panel1"
Panel1.Visible = True
Panel2.Visible = False
Panel3.Visible = False
Panel4.Visible = False
Case "Panel2"
etc...
End Select
Return Nothing
End Function
However when I do this I get the following error message
"System.NullReferenceException: Object reference not set to an instance of
an object."
Any ideas?
You help is much appreciated.
Regards,
Kevin Humphreys.