<
      
      
        asp:DropDownList 
      
      
        ID
      
      
        ="
        
          
            ddlTown
          
        
        "
      
      
         runat
      
      
        ="server"
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="-1"
      
      
        >
      
      ---选择乡镇---
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="沂城街道"
      
      
        >
      
      沂城街道
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="道托镇"
      
      
        >
      
      道托镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="高桥镇"
      
      
        >
      
      高桥镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="马站镇"
      
      
        >
      
      马站镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="杨庄镇"
      
      
        >
      
      杨庄镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="富官庄镇"
      
      
        >
      
      富官庄镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="圈里乡"
      
      
        >
      
      圈里乡
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="沙沟镇"
      
      
        >
      
      沙沟镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="诸葛镇"
      
      
        >
      
      诸葛镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="泉庄镇"
      
      
        >
      
      泉庄镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="龙家圈镇"
      
      
        >
      
      龙家圈镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="黄山铺镇"
      
      
        >
      
      黄山铺镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="崔家峪"
      
      
        >
      
      崔家峪
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="夏蔚镇"
      
      
        >
      
      夏蔚镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="高庄镇"
      
      
        >
      
      高庄镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="沂蒙风情旅游区(院东头镇)"
      
      
        >
      
      沂蒙风情旅游区(院东头镇)
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="许家湖镇"
      
      
        >
      
      许家湖镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="四十里镇"
      
      
        >
      
      四十里镇
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        <
      
      
        asp:ListItem 
      
      
        Value
      
      
        ="开发区"
      
      
        >
      
      开发区
      
        </
      
      
        asp:ListItem
      
      
        >
      
      
        </
      
      
        asp:DropDownList
      
      
        >
      
      
        <
      
      
        asp:CustomValidator 
      
      
        ID
      
      
        ="CustomValidator1"
      
      
         runat
      
      
        ="server"
      
      
         ErrorMessage
      
      
        ="*请选择乡镇"
      
      
         ClientValidationFunction
      
      
        ="ChkDropDownList"
      
      
         ControlToValidate
      
      
        ="ddlTown"
      
      
        ></
      
      
        asp:CustomValidator
      
      
        >
      
    
   
  
    
      
        function
      
      
         ChkDropDownList(source, args) {
                        
      
      
        if
      
       (args.Value == "-1"
      
        )//当下拉菜单选择的是-1的时候,就是没有选择
                            args.IsValid 
      
      = 
      
        false
      
      
        ;
                        
      
      
        else
      
      
        
                            args.IsValid 
      
      = 
      
        true
      
      
        ;
                    }  
      
    
   
  
    
      
        public
      
      
        void
      
       selectValue(DropDownList ddl, 
      
        string
      
      
         value)
        {
            
      
      
        foreach
      
       (ListItem item 
      
        in
      
      
         ddl.Items)
            {
                
      
      
        if
      
       (value ==
      
         item.Value)
                    item.Selected 
      
      = 
      
        true
      
      
        ;
            }
        }