Due to size of data I divided my dataset into five feature classes and published five different map services. Now I would like to call specific map service depending from the user input in a text box (InputPED.Text). For example all my fields beginning from 01, and 02 are included in MN map service, when 07 and 08 in BX. So if user types 01002 (or any other number beginning from 01), I would like to call and display MN, but when this is 07001 ??? BX.
At first I tried following expression:
if (InputPED.Text == "01002")
{
strQueryTaskURL = "url of my MN map service???
}
And it worked fine.
Later I tried to solve the problem in the following way:
//MN
if (InputPED.Text == " '01%' OR '02%'")
{
strQueryTaskURL = "url of my MN map service???
}
//BX
else if (InputPED.Text == "'07%' OR '08%' ")
{
strQueryTaskURL = "url of my BX map service???
}
And none of map services url???s was selected. Instead I received an error: ???Invalid Operation Exception was unhandled by user code. URL is not set???.
So I tried use LIKE
if (InputPED.Text "LIKE'01% OR '02%'")
{
strQueryTaskURL = "url of my MN map service???
}
But it gives me four errors referring to line if (InputPED.Text "LIKE'07% OR '08%'"):
1. ) expected, 2. Invalid expression term ???)???, 3. and 4. ; expected.
I also tried to use Booleans:
string sOptForPED = InputPED.Text.ToString().Trim();
bool bOptForPED = Convert.ToBoolean(sOptForPED);
if (bOptForPED "LIKE '01%'")
{
strQueryTaskURL = "url of my MN map service???
}
And received errors like above ( ) expected, 2. Invalid expression term ???)???, 3. and 4. ; expected).
I tried to use other wild cards ???LIKE ???01#???, ???LIKE ???01*??? and nothing.
Does anyone have any idea how to solve this problem?