2012-06-26 4 views
0

마녀가 가장 낮은 값을 찾기 위해 코드를 작성했지만 "If"연산자에 두 개 또는 세 개의 피연산자가 필요합니다. " 어떤 문제가 도움이 될지 확신 할 수 없다.asp.net 'If'연산자에 두 개 또는 세 개의 피연산자가 필요합니다.

<%  

      dim HP_RegularPayment As Integer = HP_RegularPayment 
      dim LPC_RegularPayment As Integer = LPC_RegularPayment 
      dim PCP_RegularPayment As Integer = PCP_RegularPayment 

      if HP_RegularPayment < LPC_RegularPayment and if HP_RegularPayment < PCP_RegularPayment then 
       %> 
       <div id="detailsprice" style="height:70px; padding-top:5px;"> 
       £<% if DiscountPrice.Text = "" then 
        Response.Write(DiscountPrice.Text) 
       else 
        Response.Write(Price.Text) 
       end if 
       %><br /> <span style="font-size:12px;">Or £<%Response.Write(HP_RegularPayment) %> Per Month With HP Finance</span> </div> <% 

      else if LPC_RegularPayment < HP_RegularPayment and if LPC_RegularPayment < PCP_RegularPayment then 
       %> 
       <div id="detailsprice" style="height:70px; padding-top:5px;"> 
       £<% if DiscountPrice.Text = "" then 
        Response.Write(DiscountPrice.Text) 
       else 
        Response.Write(Price.Text) 
       end if 
       %><br /> <span style="font-size:12px;">Or £<%Response.Write(LPC_RegularPayment) %> 
       Per Month With LP Finance</span> </div> <% 

      else if PCP_RegularPayment < HP_RegularPayment and if PCP_RegularPayment < LPC_RegularPayment then 
       %> 
       <div id="detailsprice" style="height:70px; padding-top:5px;"> 
       £<% if DiscountPrice.Text = "" then 
        Response.Write(DiscountPrice.Text) 
       else 
        Response.Write(Price.Text) 
       end if 
       %><br /> <span style="font-size:12px;">Or £<%Response.Write(PCP_RegularPayment) %> Per Month With PCP Finance</span> </div> <% 
      else%> 

      <div id="detailsprice"> 
       £<% if DiscountPrice.Text = "" then 
        Response.Write(DiscountPrice.Text) 
       else 
        Response.Write(Price.Text) 
       end if 

      end if%> 

감사 루이스

+1

마크 업과 코드를 구분해야합니다. – IrishChieftain

+0

당신의 권리는 내가해야하지만, 나는 이것이 단지 멍청하고 더러운 빌드 인 코드의 유용성을 만들 시간이 없다. –

답변

3

...

VB.NET has an operator 은 두 개 또는 세 개의 매개 변수를 취하고 첫 번째가 Nothing 인 경우 두 번째 매개 변수를 반환합니다. 라인을 만드는

를 제거 ... 나는 또한 당신이 정말로 코드를 분리하고 마크 업을해야한다는 그의 의견에 @IrishChieftain에 동의

if HP_RegularPayment < LPC_RegularPayment and HP_RegularPayment < PCP_RegularPayment then 

.

2

대신

if HP_RegularPayment < LPC_RegularPayment and if HP_RegularPayment < PCP_RegularPayment then 

사용

기존 if 문 각각 내의 다른 if있어 때문입니다
if HP_RegularPayment < LPC_RegularPayment and HP_RegularPayment < PCP_RegularPayment then 
관련 문제