ASP.NET button control OnClick event doesn't fire


M

mbs57

Greetings,

I have a page where there are three "not visible" tables, each with
fields and a button to submit the form. A user chooses one of three
options from a drop down list. The corresponding table is shown
depending on the choice.

The button OnClick event fires fine on two of the buttons, but doesn't
on the other one. I have compared all of the code and tried all sorts
of things suggested by others with no success. I tried removing the
button and code and recreating it but that didn't help either.

The entire site uses a master page, this page itself uses a sub-master
page, so the hierarchy is master -> sub master -> this page. The form
tag is in the master page. I don't think this matters since the other
two buttons work fine and other controls on the site work fine.

Drop down control code snippet:
string sRole = ddlRole.SelectedValue.ToString();

switch (sRole)
{
case "REBrokerUser":
tblInvestor.Visible = false; // investor
signup fields
tblBroker.Visible = false; // broker
signup fields
tblREBroker.Visible = true; // Real Estate
signup fields
lblRegistrationMessage.Text = "<removed>";
break;

case "Investor":

tblInvestor.Visible = true; // investor
signup fields
tblBroker.Visible = false; // broker
signup fields
tblREBroker.Visible = false; // Real
Estate signup fields
lblRegistrationMessage.Text = "<removed>";
break;

case "Broker":
tblBroker.Visible = true; // broker
signup fields
tblInvestor.Visible = false; // investor
signup fields
tblREBroker.Visible = false; // Real
Estate signup fields
lblRegistrationMessage.Text = "<removed>";
break;

default:
tblBroker.Visible = false;
tblInvestor.Visible = false;
tblREBroker.Visible = false; // Real
Estate signup fields
break;

}
}

Table code with button that doesn't fire:
<table id="tblBroker" cellpadding="2" cellspacing="0" border="0"
class="content" runat="server" width="650px">
<tr>
<td style="width: 10px">&nbsp;</td>
<td colspan="7" align="left">Please note that
fields in <strong>BOLD</strong> are required</td>
</tr>
<tr>
<td colspan="8">&nbsp;</td>
</tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" style="width:
135px"><strong>First Name:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerFirstName"
runat="server" width="135px"></asp:TextBox>
</td>
<td style="width: 30px"
align="center"><asp:RequiredFieldValidator ID="rfvBrokerFirstName"
runat="server"
ControlToValidate="txtBrokerFirstName"
Display="Dynamic"
ErrorMessage="**"></
asp:RequiredFieldValidator>
</td>
<td style="width: 5px" align="center">&nbsp;</td>
<td align="right" style="width:
135px"><strong>Company:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerCompany"
runat="server" Width="135px"></asp:TextBox>
</td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator
ID="rfvBrokerCompany" runat="server"
ControlToValidate="txtBrokerCompany"
Display="Dynamic"
ErrorMessage="**"></
asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" style="width: 135px"><strong>Last
Name:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerLastName"
runat="server" width="135px"></asp:TextBox>
</td>
<td style="width: 30px"
align="center"><asp:RequiredFieldValidator ID="rfvBrokerLastName"
runat="server"
ControlToValidate="txtBrokerLastName"
Display="Dynamic"
ErrorMessage="**"></
asp:RequiredFieldValidator>
</td>
<td style="width: 5px" align="center">&nbsp;</td>
<td align="right" style="width:
135px"><strong>Phone Number:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerPhone"
runat="server" Width="135px"></asp:TextBox>
</td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator ID="rfBrokerPhone"
runat="server"
ControlToValidate="txtBrokerPhone"
Display="Dynamic"
ErrorMessage="**"></
asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" style="width:
135px"><strong>Address:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerAddress"
runat="server" Width="135px"></asp:TextBox>
</td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator
ID="rfvBrokerAddress" runat="server"
ControlToValidate="txtBrokerAddress"
Display="Dynamic"
ErrorMessage="**"></
asp:RequiredFieldValidator>
</td>
<td style="width: 5px" align="center">&nbsp;</td>
<td align="right" style="width:
135px"><strong>Phone Type:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:DropDownList ID="ddlBrokerPhoneType"
runat="server" width="135px">
<asp:ListItem Text="Choose a Type:"
Value="0" />
<asp:ListItem Text="Work"
Value="Work" />
<asp:ListItem Text="Home"
Value="Home" />
<asp:ListItem Text="Mobile"
Value="Mobile" />
</asp:DropDownList>
</td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator
ID="rfBrokerPhoneType" runat="server"
ControlToValidate="ddlBrokerPhoneType"
Display="Dynamic"
ErrorMessage="**" InitialValue="0"></
asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" style="width: 135px">Suite/
Unit#:&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerAddress2"
runat="server" Width="135px"></asp:TextBox>
</td>
<td style="width: 30px" align="center">&nbsp;</td>
<td style="width: 5px" align="center">&nbsp;</td>
<td align="right" style="width:
135px">Website:&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerWebsite"
runat="server" Width="135px"></asp:TextBox>
</td>
<td style="width: 30px" align="center">&nbsp;</td>
</tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" style="width:
135px"><strong>City:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerCity" runat="server"
Width="135px"></asp:TextBox>
</td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator ID="rfvBrokerCity"
runat="server"
ControlToValidate="txtBrokerCity"
Display="Dynamic" ErrorMessage="**"></asp:RequiredFieldValidator>
</td>
<td style="width: 5px" align="center">&nbsp;</td>
<td align="right" style="width:
135px"><strong>Password:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerPassword"
runat="server" Width="135px" TextMode="Password"></asp:TextBox>
</td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator ID="rfvBrokerPassword"
runat="server"
ControlToValidate="txtBrokerPassword"
Display="Dynamic"
ErrorMessage="**"></
asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" style="width:
135px"><strong>State:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:DropDownList ID="ddlBrokerState"
runat="server">
<asp:ListItem Text="Select a State:"
Value="0" />
<asp:ListItem Text="California" Value="CA" />
<asp:ListItem Text="Alabama" Value="AL" />
<asp:ListItem Text="Alaska" Value="AK" />
<asp:ListItem Text="Arizona" Value="AZ" />
<asp:ListItem Text="Arkansas" Value="AR" />
<asp:ListItem Text="Colorado" Value="CO" />
<asp:ListItem Text="Connecticut" Value="CT" />
<asp:ListItem Text="Delaware" Value="DE" />
<asp:ListItem Text="Florida" Value="FL" />
<asp:ListItem Text="Georgia" Value="GA" />
<asp:ListItem Text="Hawaii" Value="HI" />
<asp:ListItem Text="Idaho" Value="ID" />
<asp:ListItem Text="Illinois" Value="IL" />
<asp:ListItem Text="Indiana" Value="IN" />
<asp:ListItem Text="Iowa" Value="IA" />
<asp:ListItem Text="Kansas" Value="KS" />
<asp:ListItem Text="Kentucky" Value="KY" />
<asp:ListItem Text="Louisiana" Value="LA" />
<asp:ListItem Text="Maine" Value="ME" />
<asp:ListItem Text="Michigan" Value="MI" />
<asp:ListItem Text="Minnesota" Value="MN" />
<asp:ListItem Text="Mississippi" Value="MS" />
<asp:ListItem Text="Missouri" Value="MO" />
<asp:ListItem Text="Montana" Value="MT" />
<asp:ListItem Text="North Carolina"
Value="NC" />
<asp:ListItem Text="North Dakota" Value="ND" /<asp:ListItem Text="Nebraska" Value="NE" />
<asp:ListItem Text="New Jersey" Value="NJ" />
<asp:ListItem Text="New Mexico" Value="NM" />
<asp:ListItem Text="New York" Value="NY" />
<asp:ListItem Text="Ohio" Value="OH" />
<asp:ListItem Text="Oklahoma" Value="OK" />
<asp:ListItem Text="Rhode Island" Value="RI" /<asp:ListItem Text="South Carolina"
Value="SC" />
<asp:ListItem Text="South Dakota" Value="SD" /<asp:ListItem Text="Tennessee" Value="TN" />
<asp:ListItem Text="Texas" Value="TX" />
<asp:ListItem Text="Utah" Value="UT" />
<asp:ListItem Text="Vermont" Value="VT" />
<asp:ListItem Text="Virginia" Value="VA" />
<asp:ListItem Text="West Virginia" Value="WV" /<asp:ListItem Text="Wisconsin" Value="WI" />
<asp:ListItem Text="Wyoming" Value="WY" />
</asp:DropDownList>
</td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator ID="rfvBrokerState"
runat="server"
ControlToValidate="ddlBrokerState"
Display="Dynamic" ErrorMessage="**"
InitialValue="0"></
asp:RequiredFieldValidator>
</td>
<td style="width: 5px" align="center">&nbsp;</td>
<td align="right" style="width:
135px"><strong>Verify Password:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerVerifyPassword"
Width="135px" runat="server" TextMode="Password"></asp:TextBox>
</td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator
ID="rfvBrokerPasswordVerify" runat="server"
ControlToValidate="txtBrokerVerifyPassword"
Display="Dynamic" ErrorMessage="**"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" style="width: 135px"><strong>Zip
Code:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerZip" Width="50px"
runat="server" MaxLength="5"></asp:TextBox>
</td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator ID="rfvBrokerZip"
runat="server"
ControlToValidate="txtBrokerZip"
Display="Dynamic"
ErrorMessage="**"></
asp:RequiredFieldValidator>
</td>
<td style="width: 5px" align="center">&nbsp;</td>
<td align="right" colspan="2">
<asp:CompareValidator ID="cvBrokerPassword"
runat="server"
ControlToCompare="txtBrokerPassword"
ControlToValidate="txtBrokerVerifyPassword"
Display="Dynamic"
ErrorMessage="* Your passwords do not match
*"></asp:CompareValidator>
</td>
<td style="width: 30px" align="center">&nbsp;</td>
</tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" style="width:
135px"><strong>Email Address:</strong>&nbsp;</td>
<td style="width: 135px" align="left">
<asp:TextBox ID="txtBrokerEmail" runat="server"
Width="135px"></asp:TextBox>
</td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator ID="rfvBrokerEmail"
runat="server"
ControlToValidate="txtBrokerEmail"
Display="Dynamic"
ErrorMessage="**"></
asp:RequiredFieldValidator>
</td>
<td style="width: 5px" align="center">&nbsp;</td>
<td align="right" style="width: 135px">&nbsp;</td>
<td style="width: 135px" align="left">&nbsp;</td>
<td style="width: 30px" align="center">&nbsp;</td>
</
tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" valign="middle" style="width:
135px"><strong>Title:</strong>&nbsp;</td>
<td align="left" colspan="6">
<asp:DropDownList ID="ddlBrokerTitle"
runat="server"
onchange="if(this.value == 'Other')
{document.getElementById('spBrokerTitle_Other').style.display='inline'}
else{document.getElementById
('spBrokerTitle_Other').style.display='none'}">
<asp:ListItem Text="Select a Title:"
Value=""></asp:ListItem>
<asp:ListItem Text="Mortgage Broker"
Value="Mortgage Broker"></asp:ListItem>
<asp:ListItem Text="Real Estate Broker"
Value="Real Estate Broker"></asp:ListItem>
<asp:ListItem Text="Real Estate Sales
(Realtor)"
Value="Real Estate Sales (Realtor)"></
asp:ListItem>
<asp:ListItem Text="Real Estate Consultant"
Value="Real Estate Consultant"></asp:ListItem>
<asp:ListItem Text="Real Estate Investment
Trust"
Value="Real Estate Investment Trust"></
asp:ListItem>
<asp:ListItem Text="Commercial Real Estate
Broker"
Value="Commercial Real Estate
Broker"></asp:ListItem>
<asp:ListItem Text="CA Finance Lender"
Value="CA Finance Lender"></asp:ListItem>
<asp:ListItem Text="Commercial Banker"
Value="Commercial Banker"></asp:ListItem>
<asp:ListItem Text="Borrower"
Value="Borrower"></asp:ListItem>
<asp:ListItem Text="Builder"
Value="Builder"></asp:ListItem>
<asp:ListItem Text="Other" Value="Other"></
asp:ListItem>
</asp:DropDownList>&nbsp;&nbsp;
<asp:RequiredFieldValidator ID="rfvTitle"
runat="server"
ControlToValidate="ddlBrokerTitle"
Display="Dynamic" ErrorMessage="**"></asp:RequiredFieldValidator>
<span id="spBrokerTitle_Other"
style="display:none">Please Specify:&nbsp;
<asp:TextBox ID="txtBrokerTitle_Other"
runat="server"></asp:TextBox>
</span>
</td>

</
tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" valign="middle" style="width:
135px"><strong>Are you Licensed?:</strong>&nbsp;</td>
<td align="left" colspan="6">
<asp:DropDownList ID="ddlBrokerIsLicensed" runat="server"
onchange="if(this.value == '1'){document.getElementById
('spBrokerIsLicensed_Yes').style.display=''}else
{document.getElementById
('spBrokerIsLicensed_Yes').style.display='none'}">
<asp:ListItem Text="Please Choose:" Value=""></asp:ListItem>
<asp:ListItem Text="No license required" Value="NotRequired"></
asp:ListItem>
<asp:ListItem Text="Yes" Value="1"></asp:ListItem>
<asp:ListItem Text="No" Value="0"></asp:ListItem>
</asp:DropDownList>&nbsp;&nbsp;
<asp:RequiredFieldValidator ID="rfLicensed" runat="server"
ControlToValidate="ddlBrokerIsLicensed"
ErrorMessage="**"
InitialValue="" Display="Dynamic"></
asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="5"><span id="spBrokerIsLicensed_Yes"
style="display:none">License Type:&nbsp;
<asp:DropDownList ID="ddlBrokerLicenseType" runat="server">
<asp:ListItem Text="Select a Type:" Value=""></asp:ListItem>
<asp:ListItem Text="Mortgage Broker" Value="Mortgage Broker"></
asp:ListItem>
<asp:ListItem Text="Mortgage Banker" Value="Mortgage Banker"></
asp:ListItem>
<asp:ListItem Text="Bank" Value="Bank"></asp:ListItem>
<asp:ListItem Text="Finance Lender" Value="Finance Lender"></
asp:ListItem>
<asp:ListItem Text="Real Estate Broker" Value="Real Estate
Broker"></asp:ListItem>
<asp:ListItem Text="Realtor" Value="Realtor"></asp:ListItem>
<asp:ListItem Text="Other" Value="Other"></asp:ListItem>
</asp:DropDownList>&nbsp;&nbsp;
License State: <pcf:State ID="pcfState" runat="server" />

</span></td>
<td style="width: 30px" align="center">&nbsp;</td>
</tr>
<tr>
<td colspan="8">&nbsp;</td>
</
tr>
<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" colspan="6"><span
id="spHowdidYouHearAboutUs" runat="server"><strong>How did you hear
about Point Center?</strong>&nbsp;
<asp:DropDownList ID="ddlReferrer" runat="server"
onchange="if(this.value == 'Other'){document.getElementById
('spReferrer_other').style.display='block'}else{document.getElementById
('spReferrer_other').style.display='none'}">
<asp:ListItem Text="Please Choose: " Value="" />
<asp:ListItem Text="Mailer" Value="Mailer" />
<asp:ListItem Text="Email Communication" Value="Email" />
<asp:ListItem Text="Brochure/Flyer" Value="Brochure/Flyer" />
<asp:ListItem Text="Advertising" Value="Advertising" />
<asp:ListItem Text="Referral - Family or Friend" Value="Referral
- Family or Friend" />
<asp:ListItem Text="Referral - Business Associate"
Value="Referral - Business Associate" />
<asp:ListItem Text="Search Engine" Value="Search Engine" />
<asp:ListItem Text="Trade Show" Value="Trade Show" />
<asp:ListItem Text="Other" Value="Other" />
</asp:DropDownList></span></td>
<td style="width: 30px" align="center">
<asp:RequiredFieldValidator ID="rfvHearAbout"
runat="server"
ControlToValidate="ddlReferrer"
Display="Dynamic" ErrorMessage="**"></asp:RequiredFieldValidator>

</td>
</
tr>

<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" colspan="6">
<span id="spReferrer_other"
style="display:none">&nbsp;Please Specify: <asp:TextBox
ID="txtReferrer_Other" runat="server"></asp:TextBox></span>
</td>
<td style="width: 30px" align="center">&nbsp;</td>
</
tr>

<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" colspan="7"><hr
noshade="noshade" /></td>
</
tr>

<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" colspan="7"><input type="reset"
value="Clear Form" />&nbsp;&nbsp;
<asp:Button ID="btnBrokerAccount"
runat="server"
onclick="btnBrokerAccount_Click"
Text="Register Now" />
&nbsp;&nbsp;
</td>
</
tr>

<tr>
<td style="width: 10px">&nbsp;</td>
<td align="right" colspan="7">&nbsp;</td>
</
tr>
</table>

The field validation works fine, but it never gets to the OnClick
event. Again, the other two buttons on this page work fine.

Would anybody be able to help? I am at my wits end on this one.
Thanks in advance,
Mike
 
Ad

Advertisements

M

mbs57

Greetings,

I have a page where there are three "not visible" tables, each with
fields and a button to submit the form.  A user chooses one of three
options from a drop down list.  The corresponding table is shown
depending on the choice.

The button OnClick event fires fine on two of the buttons, but doesn't
on the other one.  I have compared all of the code and tried all sorts
of things suggested by others with no success.  I tried removing the
button and code and recreating it but that didn't help either.

The entire site uses a master page, this page itself uses a sub-master
page, so the hierarchy is master -> sub master -> this page.  The form
tag is in the master page.  I don't think this matters since the other
two buttons work fine and other controls on the site work fine.

Drop down control code snippet:
                string sRole = ddlRole.SelectedValue.ToString();

                switch (sRole)
                {
                    case "REBrokerUser":
                        tblInvestor.Visible = false;   // investor
signup fields
                        tblBroker.Visible = false;       // broker
signup fields
                        tblREBroker.Visible = true;     // Real Estate
signup fields
                        lblRegistrationMessage.Text = "<removed>";
                        break;

                    case "Investor":

                        tblInvestor.Visible = true;   // investor
signup fields
                        tblBroker.Visible = false;       // broker
signup fields
                        tblREBroker.Visible = false;     // Real
Estate signup fields
                        lblRegistrationMessage.Text = "<removed>";
                        break;

                    case "Broker":
                        tblBroker.Visible = true;       // broker
signup fields
                        tblInvestor.Visible = false;    // investor
signup fields
                        tblREBroker.Visible = false;     // Real
Estate signup fields
                        lblRegistrationMessage.Text = "<removed>";
                        break;

                    default:
                        tblBroker.Visible = false;
                        tblInvestor.Visible = false;
                        tblREBroker.Visible = false;     // Real
Estate signup fields
                        break;

                }
            }

Table code with button that doesn't fire:
<table id="tblBroker" cellpadding="2" cellspacing="0" border="0"
class="content" runat="server" width="650px">
               <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td colspan="7" align="left">Please note that
fields in <strong>BOLD</strong> are required</td>
               </tr>
               <tr>
                   <td colspan="8">&nbsp;</td>
               </tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" style="width:
135px"><strong>First Name:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                       <asp:TextBox ID="txtBrokerFirstName"
runat="server" width="135px"></asp:TextBox>
                   </td>
                   <td style="width: 30px"
align="center"><asp:RequiredFieldValidator ID="rfvBrokerFirstName"
runat="server"
                            ControlToValidate="txtBrokerFirstName"
Display="Dynamic"
                            ErrorMessage="**"></
asp:RequiredFieldValidator>
                   </td>
                   <td style="width: 5px" align="center">&nbsp;</td>
                   <td align="right" style="width:
135px"><strong>Company:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                       <asp:TextBox ID="txtBrokerCompany"
runat="server" Width="135px"></asp:TextBox>
                   </td>
                   <td style="width: 30px" align="center">
                       <asp:RequiredFieldValidator
ID="rfvBrokerCompany" runat="server"
                           ControlToValidate="txtBrokerCompany"
Display="Dynamic"
                           ErrorMessage="**"></
asp:RequiredFieldValidator>
                   </td>
               </tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" style="width: 135px"><strong>Last
Name:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                       <asp:TextBox ID="txtBrokerLastName"
runat="server" width="135px"></asp:TextBox>
                   </td>
                   <td style="width: 30px"
align="center"><asp:RequiredFieldValidator ID="rfvBrokerLastName"
runat="server"
                            ControlToValidate="txtBrokerLastName"
Display="Dynamic"
                            ErrorMessage="**"></
asp:RequiredFieldValidator>
                   </td>
                   <td style="width: 5px" align="center">&nbsp;</td>
                   <td align="right" style="width:
135px"><strong>Phone Number:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                        <asp:TextBox ID="txtBrokerPhone"
runat="server" Width="135px"></asp:TextBox>
                   </td>
                   <td style="width: 30px" align="center">
                    <asp:RequiredFieldValidator ID="rfBrokerPhone"
runat="server"
                        ControlToValidate="txtBrokerPhone"
Display="Dynamic"
                        ErrorMessage="**"></
asp:RequiredFieldValidator>
                   </td>
               </tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" style="width:
135px"><strong>Address:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                       <asp:TextBox ID="txtBrokerAddress"
runat="server" Width="135px"></asp:TextBox>
                   </td>
                   <td style="width: 30px" align="center">
                       <asp:RequiredFieldValidator
ID="rfvBrokerAddress" runat="server"
                           ControlToValidate="txtBrokerAddress"
Display="Dynamic"
                           ErrorMessage="**"></
asp:RequiredFieldValidator>
                   </td>
                   <td style="width: 5px" align="center">&nbsp;</td>
                   <td align="right" style="width:
135px"><strong>Phone Type:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                            <asp:DropDownListID="ddlBrokerPhoneType"
runat="server" width="135px">
                                <asp:ListItem Text="Choose a Type:"
Value="0" />
                                <asp:ListItem Text="Work"
Value="Work" />
                                <asp:ListItem Text="Home"
Value="Home" />
                                <asp:ListItem Text="Mobile"
Value="Mobile" />
                            </asp:DropDownList>
                   </td>
                   <td style="width: 30px" align="center">
                            <asp:RequiredFieldValidator
ID="rfBrokerPhoneType" runat="server"
                                ControlToValidate="ddlBrokerPhoneType"
Display="Dynamic"
                                ErrorMessage="**" InitialValue="0"></
asp:RequiredFieldValidator>
                   </td>
               </tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" style="width: 135px">Suite/
Unit#:&nbsp;</td>
                   <td style="width: 135px" align="left">
                       <asp:TextBox ID="txtBrokerAddress2"
runat="server" Width="135px"></asp:TextBox>
                   </td>
                   <td style="width: 30px" align="center">&nbsp;</td>
                   <td style="width: 5px" align="center">&nbsp;</td>
                   <td align="right" style="width:
135px">Website:&nbsp;</td>
                   <td style="width: 135px" align="left">
                       <asp:TextBox ID="txtBrokerWebsite"
runat="server" Width="135px"></asp:TextBox>
                   </td>
                   <td style="width: 30px" align="center">&nbsp;</td>
               </tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" style="width:
135px"><strong>City:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                       <asp:TextBox ID="txtBrokerCity" runat="server"
Width="135px"></asp:TextBox>
                   </td>
                   <td style="width: 30px" align="center">
                       <asp:RequiredFieldValidator ID="rfvBrokerCity"
runat="server"
                           ControlToValidate="txtBrokerCity"
Display="Dynamic" ErrorMessage="**"></asp:RequiredFieldValidator>
                   </td>
                   <td style="width: 5px" align="center">&nbsp;</td>
                   <td align="right" style="width:
135px"><strong>Password:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                       <asp:TextBox ID="txtBrokerPassword"
runat="server" Width="135px" TextMode="Password"></asp:TextBox>
                   </td>
                   <td style="width: 30px" align="center">
                    <asp:RequiredFieldValidator ID="rfvBrokerPassword"
runat="server"
                        ControlToValidate="txtBrokerPassword"
Display="Dynamic"
                        ErrorMessage="**"></
asp:RequiredFieldValidator>
                   </td>
               </tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" style="width:
135px"><strong>State:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                        <asp:DropDownList ID="ddlBrokerState"
runat="server">
                        <asp:ListItem Text="Select a State:"
Value="0" />
                        <asp:ListItem Text="California" Value="CA" />
                        <asp:ListItem Text="Alabama" Value="AL" />
                        <asp:ListItem Text="Alaska" Value="AK" />
                        <asp:ListItem Text="Arizona" Value="AZ" />
                        <asp:ListItem Text="Arkansas" Value="AR" />
                        <asp:ListItem Text="Colorado" Value="CO" />
                        <asp:ListItem Text="Connecticut" Value="CT" />
                        <asp:ListItem Text="Delaware" Value="DE" />
                        <asp:ListItem Text="Florida" Value="FL" />
                        <asp:ListItem Text="Georgia" Value="GA" />
                        <asp:ListItem Text="Hawaii" Value="HI" />
                        <asp:ListItem Text="Idaho" Value="ID" />
                        <asp:ListItem Text="Illinois" Value="IL" />
                        <asp:ListItem Text="Indiana" Value="IN" />
                        <asp:ListItem Text="Iowa" Value="IA" />
                        <asp:ListItem Text="Kansas" Value="KS" />
                        <asp:ListItem Text="Kentucky" Value="KY" />
                        <asp:ListItem Text="Louisiana" Value="LA" />
                        <asp:ListItem Text="Maine" Value="ME" />
                        <asp:ListItem Text="Maryland" Value="MD" />
                        <asp:ListItem Text="Massachusetts" Value="MA" /

                        <asp:ListItem Text="Michigan" Value="MI" />
                        <asp:ListItem Text="Minnesota" Value="MN" />
                        <asp:ListItem Text="Mississippi" Value="MS" />
                        <asp:ListItem Text="Missouri" Value="MO" />
                        <asp:ListItem Text="Montana" Value="MT" />
                        <asp:ListItem Text="North Carolina"
Value="NC" />
                        <asp:ListItem Text="North Dakota" Value="ND" /

                        <asp:ListItem Text="Nebraska" Value="NE" />
                        <asp:ListItem Text="Nevada" Value="NV" />
                        <asp:ListItem Text="NewHampshire" Value="NH" /

                        <asp:ListItem Text="NewJersey" Value="NJ" />
                        <asp:ListItem Text="NewMexico" Value="NM" />
                        <asp:ListItem Text="NewYork" Value="NY" />
                        <asp:ListItem Text="Ohio" Value="OH" />
                        <asp:ListItem Text="Oklahoma" Value="OK" />
                        <asp:ListItem Text="Oregon" Value="OR" />
                        <asp:ListItem Text="Pennsylvania" Value="PA" /

                        <asp:ListItem Text="Rhode Island" Value="RI" /

                        <asp:ListItem Text="South Carolina"
Value="SC" />
                        <asp:ListItem Text="South Dakota" Value="SD" /

                        <asp:ListItem Text="Tennessee" Value="TN" />
                        <asp:ListItem Text="Texas" Value="TX" />
                        <asp:ListItem Text="Utah" Value="UT" />
                        <asp:ListItem Text="Vermont" Value="VT" />
                        <asp:ListItem Text="Virginia" Value="VA" />
                        <asp:ListItem Text="Washington" Value="WA" />
                        <asp:ListItem Text="Washington DC" Value="DC" /

                        <asp:ListItem Text="West Virginia" Value="WV" /

                        <asp:ListItem Text="Wisconsin" Value="WI" />
                        <asp:ListItem Text="Wyoming" Value="WY" />
                        </asp:DropDownList>
                   </td>
                   <td style="width: 30px" align="center">
                       <asp:RequiredFieldValidator ID="rfvBrokerState"
runat="server"
                           ControlToValidate="ddlBrokerState"
Display="Dynamic" ErrorMessage="**"
                           InitialValue="0"></
asp:RequiredFieldValidator>
                   </td>
                   <td style="width: 5px" align="center">&nbsp;</td>
                   <td align="right" style="width:
135px"><strong>Verify Password:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                    <asp:TextBox  ID="txtBrokerVerifyPassword"
Width="135px" runat="server" TextMode="Password"></asp:TextBox>
                   </td>
                   <td style="width: 30px" align="center">
                       <asp:RequiredFieldValidator
ID="rfvBrokerPasswordVerify" runat="server"
                           ControlToValidate="txtBrokerVerifyPassword"
Display="Dynamic" ErrorMessage="**"></asp:RequiredFieldValidator>
                   </td>
               </tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" style="width: 135px"><strong>Zip
Code:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                       <asp:TextBox ID="txtBrokerZip" Width="50px"
runat="server" MaxLength="5"></asp:TextBox>
                   </td>
                   <td style="width: 30px" align="center">
                    <asp:RequiredFieldValidator ID="rfvBrokerZip"
runat="server"
                        ControlToValidate="txtBrokerZip"
Display="Dynamic"
                        ErrorMessage="**"></
asp:RequiredFieldValidator>
                   </td>
                   <td style="width: 5px" align="center">&nbsp;</td>
                   <td align="right" colspan="2">
                    <asp:CompareValidator ID="cvBrokerPassword"
runat="server"
                        ControlToCompare="txtBrokerPassword"
                        ControlToValidate="txtBrokerVerifyPassword"
Display="Dynamic"
                        ErrorMessage="* Your passwords do not match
*"></asp:CompareValidator>
                   </td>
                   <td style="width: 30px" align="center">&nbsp;</td>
               </tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" style="width:
135px"><strong>Email Address:</strong>&nbsp;</td>
                   <td style="width: 135px" align="left">
                    <asp:TextBox ID="txtBrokerEmail" runat="server"
Width="135px"></asp:TextBox>
                   </td>
                   <td style="width: 30px" align="center">
                    <asp:RequiredFieldValidator ID="rfvBrokerEmail"
runat="server"
                        ControlToValidate="txtBrokerEmail"
Display="Dynamic"
                        ErrorMessage="**"></
asp:RequiredFieldValidator>
                   </td>
                   <td style="width: 5px" align="center">&nbsp;</td>
                   <td align="right" style="width: 135px">&nbsp;</td>
                   <td style="width: 135px" align="left">&nbsp;</td>
                   <td style="width: 30px" align="center">&nbsp;</td>
               </
tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" valign="middle" style="width:
135px"><strong>Title:</strong>&nbsp;</td>
                   <td align="left" colspan="6">
                       <asp:DropDownList ID="ddlBrokerTitle"
runat="server"
                            onchange="if(this.value == 'Other')
{document.getElementById('spBrokerTitle_Other').style.display='inline'}
else{document.getElementById
('spBrokerTitle_Other').style.display='none'}">
                           <asp:ListItem Text="Select a Title:"
Value=""></asp:ListItem>
                           <asp:ListItem Text="Mortgage Broker"
Value="Mortgage Broker"></asp:ListItem>
                           <asp:ListItem Text="Real Estate Broker"
Value="Real Estate Broker"></asp:ListItem>
                           <asp:ListItem Text="Real Estate Sales
(Realtor)"
                                Value="Real Estate Sales (Realtor)"></
asp:ListItem>
                           <asp:ListItem Text="Real Estate Consultant"
Value="Real Estate Consultant"></asp:ListItem>
                           <asp:ListItem Text="Real Estate Investment
Trust"
                                Value="Real Estate Investment Trust"></
asp:ListItem>
                           <asp:ListItem Text="Commercial Real Estate
Broker"
                                Value="Commercial Real Estate
Broker"></asp:ListItem>
                           <asp:ListItem Text="CA Finance Lender"
Value="CA Finance Lender"></asp:ListItem>
                           <asp:ListItem Text="Commercial Banker"
Value="Commercial Banker"></asp:ListItem>
                           <asp:ListItem Text="Borrower"
Value="Borrower"></asp:ListItem>
                           <asp:ListItem Text="Builder"
Value="Builder"></asp:ListItem>
                           <asp:ListItem Text="Other" Value="Other"></
asp:ListItem>
                       </asp:DropDownList>&nbsp;&nbsp;
                       <asp:RequiredFieldValidator ID="rfvTitle"
runat="server"
                           ControlToValidate="ddlBrokerTitle"
Display="Dynamic" ErrorMessage="**"></asp:RequiredFieldValidator>
                       <span id="spBrokerTitle_Other"
style="display:none">Please Specify:&nbsp;
                           <asp:TextBox ID="txtBrokerTitle_Other"
runat="server"></asp:TextBox>
                       </span>
                   </td>

               </
tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" valign="middle" style="width:
135px"><strong>Are you Licensed?:</strong>&nbsp;</td>
                   <td align="left" colspan="6">
                                        <asp:DropDownList ID="ddlBrokerIsLicensed" runat="server"
onchange="if(this.value == '1'){document.getElementById
('spBrokerIsLicensed_Yes').style.display=''}else
{document.getElementById
('spBrokerIsLicensed_Yes').style.display='none'}">
                                                <asp:ListItem Text="Please Choose:" Value=""></asp:ListItem>
                                                <asp:ListItem Text="No license required" Value="NotRequired"></
asp:ListItem>
                                                <asp:ListItem Text="Yes" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="No" Value="0"></asp:ListItem>
                                        </asp:DropDownList>&nbsp;&nbsp;
                                    <asp:RequiredFieldValidator ID="rfLicensed" runat="server"
                        ControlToValidate="ddlBrokerIsLicensed"
ErrorMessage="**"
                        InitialValue="" Display="Dynamic"></
asp:RequiredFieldValidator>
                   </td>
               </tr>
               <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td colspan="5"><span id="spBrokerIsLicensed_Yes"
style="display:none">License Type:&nbsp;
                                        <asp:DropDownList ID="ddlBrokerLicenseType" runat="server">
                                                <asp:ListItem Text="Select a Type:" Value=""></asp:ListItem>
                                                <asp:ListItem Text="Mortgage Broker" Value="Mortgage Broker"></
asp:ListItem>
                                                <asp:ListItem Text="Mortgage Banker" Value="Mortgage Banker"></
asp:ListItem>
                                                <asp:ListItem Text="Bank" Value="Bank"></asp:ListItem>
                                                <asp:ListItem Text="Finance Lender" Value="Finance Lender"></
asp:ListItem>
                                                <asp:ListItem Text="Real Estate Broker" Value="Real Estate
Broker"></asp:ListItem>
                                                <asp:ListItem Text="Realtor" Value="Realtor"></asp:ListItem>
                                                <asp:ListItem Text="Other" Value="Other"></asp:ListItem>
                                        </asp:DropDownList>&nbsp;&nbsp;
                                        License State: <pcf:State ID="pcfState" runat="server" />

                                    </span></td>
                   <td style="width: 30px" align="center">&nbsp;</td>
               </tr>
               <tr>
                   <td colspan="8">&nbsp;</td>
               </
tr>
                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" colspan="6"><span
id="spHowdidYouHearAboutUs" runat="server"><strong>How did you hear
about Point Center?</strong>&nbsp;
                   <asp:DropDownList ID="ddlReferrer" runat="server"
onchange="if(this.value == 'Other'){document.getElementById
('spReferrer_other').style.display='block'}else{document.getElementById
('spReferrer_other').style.display='none'}">
                                        <asp:ListItem Text="Please Choose: " Value="" />
                                        <asp:ListItem Text="Mailer" Value="Mailer" />
                                        <asp:ListItem Text="Email Communication" Value="Email" />
                                        <asp:ListItem Text="Brochure/Flyer" Value="Brochure/Flyer" />
                                        <asp:ListItem Text="Advertising" Value="Advertising" />
                                        <asp:ListItem Text="Referral - Family or Friend" Value="Referral
- Family or Friend" />
                                        <asp:ListItem Text="Referral - Business Associate"
Value="Referral - Business Associate" />
                                        <asp:ListItem Text="Search Engine" Value="Search Engine" />
                                        <asp:ListItem Text="Trade Show" Value="Trade Show" />
                                        <asp:ListItem Text="Other" Value="Other" />
                                </asp:DropDownList></span></td>
                   <td style="width: 30px" align="center">
                       <asp:RequiredFieldValidator ID="rfvHearAbout"
runat="server"
                           ControlToValidate="ddlReferrer"
Display="Dynamic" ErrorMessage="**"></asp:RequiredFieldValidator>

</td>
               </
tr>

                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" colspan="6">
                                        <span id="spReferrer_other"
style="display:none">&nbsp;Please Specify: <asp:TextBox
ID="txtReferrer_Other" runat="server"></asp:TextBox></span>
                               </td>
                   <td style="width: 30px" align="center">&nbsp;</td>
               </
tr>

                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" colspan="7"><hr
noshade="noshade" /></td>
               </
tr>

                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" colspan="7"><input type="reset"
value="Clear Form" />&nbsp;&nbsp;
                        <asp:Button ID="btnBrokerAccount"
runat="server"
                           onclick="btnBrokerAccount_Click"
Text="Register Now" />
                       &nbsp;&nbsp;
                   </td>
               </
tr>

                           <tr>
                   <td style="width: 10px">&nbsp;</td>
                   <td align="right" colspan="7">&nbsp;</td>
               </
tr>
                        </table>

The field validation works fine, but it never gets to the OnClick
event.  Again, the other two buttons on this page work fine.

Would anybody be able to help?  I am at my wits end on this one.
Thanks in advance,
Mike

I finally figured it out. The page is using a user control which is a
drop down list that is initially not visible. Unless the user chooses
a specific option in one of the other visible drop downs, the hidden
one never shows. That user control has a required validation element
to it so the form wouldn't submit and since it was hidden, I couldn't
tell. The control has a "Required" property so I set that property to
"false" and it fixed the problem.

Wow, what a simple solution to a problem that had me going around in
circles for a day and a half.
 
Ad

Advertisements

S

Stan

I finally figured it out.  The page is using a user control which is a
drop down list that is initially not visible.  Unless the user chooses
a specific option in one of the other visible drop downs, the hidden
one never shows.  That user control has a required validation element
to it so the form wouldn't submit and since it was hidden, I couldn't
tell.  The control has a "Required" property so I set that property to
"false" and it fixed the problem.

Wow, what a simple solution to a problem that had me going around in
circles for a day and a half.

Hi

Looking briefly at your code I notice that "ValidationGroup" is not
set anywhere. This is crucial to the behaviour of validation controls
in all but the simplest of cases. It enables the the validation
process to be triggered when required rather than obstructively at the
wrong times (controls in the same group are only validated when the
appropriate button is clicked).

HTU
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top