Skip to content

Help with if loop string

Tom Pearson

Asked Mar 14, 2008, 5:11 AM EDT1 answer
Share
LinkedInX

i have a if string that fills a datagrid column and i need to add a 2nd part to this.

atm ppl can use a dropdown to search for specialty. i need to add a 2nd dropdown with the same specialtylist and allow ppl to search against both

here is the code if sting for the 1st speciality :

[code]

Code
if (Server.HtmlEncode(arr1[loop1])=="specialty")
sWhere += "specialty  LIKE '%" + (arr2[loop2]) + "%' AND ";
   [/code]

the column name is specialty and the dropdown is labled specialty. i added a 2nd dropdown labled specialty2...i want it to work so that if they select one from specialty and specialty2 if will filter on both selections.

how can i incorpate this into this if string?

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    i need something like this but my syntaxs is bad i know...can anyone help

    if (Server.HtmlEncode(arr1[loop1])=="specialty1")
          { 
           if ((Server.HtmlEncode(arr1[loop1])=="specialty2")
           sWhere += "specialty  LIKE '%" + (arr2[loop2])+ "%' AND ";)
           (Server.HtmlEncode(arr1[loop1])=="specialty1")
           sWhere += "specialty  LIKE '%" + (arr2[loop2]) + "%' AND ";
           }else
          
            if (Server.HtmlEncode(arr1[loop1])=="specialty1")
           sWhere += "specialty  LIKE '%" + (arr2[loop2])+ "%' AND ";
           }
          }

    0