示例#1
0
        public static string GetPro(string ProID = "1", string NameAttr = "ProvinceID")
        {
            XmlDocument   Xml = new XmlData().ProvincesXml;
            StringBuilder sb  = new StringBuilder();
            //string path = HttpContext.Current.Server.MapPath("/Content/xmlData/address/Provinces.xml");
            //Xml.Load(path);
            XmlNodeList   ProvinceNodeList = Xml.SelectNodes("//Province");
            StringBuilder strCity          = new StringBuilder();

            sb.Append("<select  class='form-control' style='width:31%;float:left;' id='pro' name='" + NameAttr + "' onchange='ProChange(this)'>");
            foreach (XmlNode node in ProvinceNodeList)
            {
                if (node.Attributes["ID"].Value == ProID)
                {
                    sb.Append("<option selected='selected' value='" + node.Attributes["ID"].Value + "'>" + node.Attributes["ProvinceName"].Value + "</option>");
                }
                else
                {
                    sb.Append("<option value='" + node.Attributes["ID"].Value + "'>" + node.Attributes["ProvinceName"].Value + "</option>");
                }
            }
            sb.Append("</select>");
            return(sb.ToString());
        }