L
Lerp
Hi all,
I have reduced my panelled page for simplified viewing below. In it I have
3 panels that I would to display/hide depending on the button pressed. It
seemed very straight forward to begin with, but my page is acting the way it
should. When I go to click the first button on the pnlAddBooking panel it
won't show me the pnlClientSearch panel and I am wondering if it because of
my validation control. What am I missing? It's gotta be something
simple..man.
Cheers, Lerp
Code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1"
debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<script language="vb" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
IF NOT Page.IsPostBack THEN
pnlAddBooking.Visible = true
pnlClientSearch.Visible = false
pnlError.Visible = false
END IF
End Sub
'SUB FOR BUTTONS
Sub buttonClick(Sender As Object, e As
system.Web.UI.WebControls.CommandEventArgs)
IF e.CommandName = "csearch" THEN
pnlAddBooking.Visible = false
pnlError.Visible = false
pnlClientSearch.Visible = true
ELSEIF e.CommandName = "booking" THEN
pnlError.Visible = false
pnlClientSearch.Visible = false
pnlAddBooking.Visible = true
ELSE
pnlAddBooking.Visible = false
pnlClientSearch.Visible = false
pnlError.Visible = true
END IF
End Sub
</script>
<!--- START OF EMPLOYEE GRID --->
<form runat="server" method="post">
<aspanel id="pnlAddBooking" runat="server" style="Z-INDEX: 101; POSITION:
absolute;">
<!--- MASTER TABLE --->
<table width="790" cellpadding="2" cellspacing="0" border="0">
<tr valign="top">
<td align="left">BOOKING ADD PANEL. <asp:Button
ID="btnCScaller" CssClass="but" CommandName="csearch"
OnCommand="buttonClick" text="Client Search" Runat="server" /></td>
</tr>
</table>
<tr height="15">
<td align="left" colspan="5"></td>
</tr>
<tr valign="top">
<td align="left" class="bodycopy">Salutation:</td>
<td align="left" class="bodycopy">
<asp:ListBox id="salutation" Rows="1" SelectionMode="Single"
CssClass="textbox" runat="server" AutoPostBack="true">
<asp:ListItem Value="" Text="Select One"/>
<asp:ListItem Value="Mr." Text="Mr."/>
<asp:ListItem Value="Mrs." Text="Mrs."/>
<asp:ListItem Value="Miss" Text="Miss"/>
<asp:ListItem Value="Dr." Text="Dr."/>
<asp:ListItem Value="Ms." Text="Ms."/>
<asp:ListItem Value="Master" Text="Master"/>
</asp:ListBox>
<asp:RequiredFieldValidator id="salutationval"
ControlToValidate="salutation" CssClass="bodyreq" Display="Dynamic"
Width="100%" ErrorMessage="Please select a salutation." RUNAT="server" />
</td>
</tr>
</aspanel>
<aspanel id="pnlError" runat="server" style="Z-INDEX: 102; POSITION:
absolute;">
<!--- MASTER TABLE --->
<table width="790" cellpadding="2" cellspacing="0" border="0">
<tr valign="top">
<td align="left">ERROR PANEL</td>
</tr>
</table>
</aspanel>
<aspanel id="pnlClientSearch" runat="server" style="Z-INDEX: 103;
POSITION: absolute;">
<table width="790" cellpadding="2" cellspacing="0" border="0">
<tr valign="top">
<td align="left">CLIENT SEARCH PANEL <asp:Button
ID="btnCScallerb" CssClass="but" CommandName="booking"
OnCommand="buttonClick" text="Add Booking" Runat="server" /></td>
</tr>
</table>
</aspanel>
</form>
I have reduced my panelled page for simplified viewing below. In it I have
3 panels that I would to display/hide depending on the button pressed. It
seemed very straight forward to begin with, but my page is acting the way it
should. When I go to click the first button on the pnlAddBooking panel it
won't show me the pnlClientSearch panel and I am wondering if it because of
my validation control. What am I missing? It's gotta be something
simple..man.
Cheers, Lerp
Code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1"
debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<script language="vb" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
IF NOT Page.IsPostBack THEN
pnlAddBooking.Visible = true
pnlClientSearch.Visible = false
pnlError.Visible = false
END IF
End Sub
'SUB FOR BUTTONS
Sub buttonClick(Sender As Object, e As
system.Web.UI.WebControls.CommandEventArgs)
IF e.CommandName = "csearch" THEN
pnlAddBooking.Visible = false
pnlError.Visible = false
pnlClientSearch.Visible = true
ELSEIF e.CommandName = "booking" THEN
pnlError.Visible = false
pnlClientSearch.Visible = false
pnlAddBooking.Visible = true
ELSE
pnlAddBooking.Visible = false
pnlClientSearch.Visible = false
pnlError.Visible = true
END IF
End Sub
</script>
<!--- START OF EMPLOYEE GRID --->
<form runat="server" method="post">
<aspanel id="pnlAddBooking" runat="server" style="Z-INDEX: 101; POSITION:
absolute;">
<!--- MASTER TABLE --->
<table width="790" cellpadding="2" cellspacing="0" border="0">
<tr valign="top">
<td align="left">BOOKING ADD PANEL. <asp:Button
ID="btnCScaller" CssClass="but" CommandName="csearch"
OnCommand="buttonClick" text="Client Search" Runat="server" /></td>
</tr>
</table>
<tr height="15">
<td align="left" colspan="5"></td>
</tr>
<tr valign="top">
<td align="left" class="bodycopy">Salutation:</td>
<td align="left" class="bodycopy">
<asp:ListBox id="salutation" Rows="1" SelectionMode="Single"
CssClass="textbox" runat="server" AutoPostBack="true">
<asp:ListItem Value="" Text="Select One"/>
<asp:ListItem Value="Mr." Text="Mr."/>
<asp:ListItem Value="Mrs." Text="Mrs."/>
<asp:ListItem Value="Miss" Text="Miss"/>
<asp:ListItem Value="Dr." Text="Dr."/>
<asp:ListItem Value="Ms." Text="Ms."/>
<asp:ListItem Value="Master" Text="Master"/>
</asp:ListBox>
<asp:RequiredFieldValidator id="salutationval"
ControlToValidate="salutation" CssClass="bodyreq" Display="Dynamic"
Width="100%" ErrorMessage="Please select a salutation." RUNAT="server" />
</td>
</tr>
</aspanel>
<aspanel id="pnlError" runat="server" style="Z-INDEX: 102; POSITION:
absolute;">
<!--- MASTER TABLE --->
<table width="790" cellpadding="2" cellspacing="0" border="0">
<tr valign="top">
<td align="left">ERROR PANEL</td>
</tr>
</table>
</aspanel>
<aspanel id="pnlClientSearch" runat="server" style="Z-INDEX: 103;
POSITION: absolute;">
<table width="790" cellpadding="2" cellspacing="0" border="0">
<tr valign="top">
<td align="left">CLIENT SEARCH PANEL <asp:Button
ID="btnCScallerb" CssClass="but" CommandName="booking"
OnCommand="buttonClick" text="Add Booking" Runat="server" /></td>
</tr>
</table>
</aspanel>
</form>