Click here to Skip to main content
15,887,822 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: entity framwork one-to-many relation Pin
Nathan Minier13-Jul-16 1:48
professionalNathan Minier13-Jul-16 1:48 
QuestionAutomating a website using Asp.net Pin
srikrishnathanthri3-Jul-16 23:56
srikrishnathanthri3-Jul-16 23:56 
AnswerRe: Automating a website using Asp.net Pin
Member 1039877314-Jul-16 21:40
Member 1039877314-Jul-16 21:40 
QuestionWeb api insert failed but code seems fine Pin
DotNetFellow1-Jul-16 19:14
DotNetFellow1-Jul-16 19:14 
QuestionRadiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
Codeaddict742330-Jun-16 9:25
Codeaddict742330-Jun-16 9:25 
QuestionRe: Radiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
ZurdoDev30-Jun-16 10:28
professionalZurdoDev30-Jun-16 10:28 
AnswerRe: Radiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
Codeaddict742330-Jun-16 10:35
Codeaddict742330-Jun-16 10:35 
GeneralRe: Radiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
Richard Deeming30-Jun-16 10:52
mveRichard Deeming30-Jun-16 10:52 
You're missing the braces around the content of the if branch. As a result, only the first statement is considered part of the if branch - as if you had written:
C#
if (rbCurrentlyEmployed.SelectedValue == "No" || rbCurrentlyEmployed.SelectedValue == "Retired" )
{ 
    ((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = false;
}

((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = false;
((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = false;
((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = false;

else
{
    ((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = true;
    ((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = true;
    ((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = true;
    ((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = true;
}

Add the braces, and the syntax error will go away:
C#
if (rbCurrentlyEmployed.SelectedValue == "No" || rbCurrentlyEmployed.SelectedValue == "Retired" )
{ 
    ((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = false;
    ((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = false;
    ((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = false;
    ((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = false;
}
else
{
    ((RequiredFieldValidator)txtEmployer.FindControl("RFV_Employment_Employer")).Enabled = true;
    ((RequiredFieldValidator)txtJobTitle.FindControl("RFV_Employment_JobTitle")).Enabled = true;
    ((RequiredFieldValidator)txtWorkPhone.FindControl("RFV_Employment_WorkPhone")).Enabled = true;
    ((RequiredFieldValidator)rbgrantsmatchingfunds.FindControl("RFV_Employment_MatchingFunds")).Enabled = true;
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Radiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
Codeaddict742330-Jun-16 11:16
Codeaddict742330-Jun-16 11:16 
GeneralRe: Radiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
Richard MacCutchan30-Jun-16 22:26
mveRichard MacCutchan30-Jun-16 22:26 
QuestionAngularjs is not refreshing data on the CSHTML page Pin
indian14330-Jun-16 2:39
indian14330-Jun-16 2:39 
AnswerRe: Angularjs is not refreshing data on the CSHTML page Pin
John C Rayan30-Jun-16 21:24
professionalJohn C Rayan30-Jun-16 21:24 
GeneralRe: Angularjs is not refreshing data on the CSHTML page Pin
indian1431-Jul-16 0:40
indian1431-Jul-16 0:40 
GeneralRe: Angularjs is not refreshing data on the CSHTML page Pin
John C Rayan1-Jul-16 1:18
professionalJohn C Rayan1-Jul-16 1:18 
GeneralRe: Angularjs is not refreshing data on the CSHTML page Pin
indian1431-Jul-16 4:15
indian1431-Jul-16 4:15 
GeneralRe: Angularjs is not refreshing data on the CSHTML page Pin
John C Rayan4-Jul-16 0:22
professionalJohn C Rayan4-Jul-16 0:22 
QuestionWhen to use ASP.NET Webforms, MVC, Web API Pin
larsp77729-Jun-16 0:04
larsp77729-Jun-16 0:04 
AnswerRe: When to use ASP.NET Webforms, MVC, Web API Pin
F-ES Sitecore30-Jun-16 1:03
professionalF-ES Sitecore30-Jun-16 1:03 
GeneralRe: When to use ASP.NET Webforms, MVC, Web API Pin
larsp77730-Jun-16 1:37
larsp77730-Jun-16 1:37 
GeneralRe: When to use ASP.NET Webforms, MVC, Web API Pin
F-ES Sitecore30-Jun-16 2:12
professionalF-ES Sitecore30-Jun-16 2:12 
GeneralRe: When to use ASP.NET Webforms, MVC, Web API Pin
larsp77730-Jun-16 2:22
larsp77730-Jun-16 2:22 
GeneralRe: When to use ASP.NET Webforms, MVC, Web API Pin
F-ES Sitecore30-Jun-16 3:02
professionalF-ES Sitecore30-Jun-16 3:02 
GeneralRe: When to use ASP.NET Webforms, MVC, Web API Pin
larsp77730-Jun-16 3:13
larsp77730-Jun-16 3:13 
GeneralRe: When to use ASP.NET Webforms, MVC, Web API Pin
Ronald.A11-Jul-16 4:05
Ronald.A11-Jul-16 4:05 
GeneralRe: When to use ASP.NET Webforms, MVC, Web API Pin
Ronald.A11-Jul-16 3:47
Ronald.A11-Jul-16 3:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.