请教下,这段代码是设置城市的,是个下拉的选择,我想找出设置这些城市的文件,并把城市换掉,要怎么做??
怎样找?这个是在数据库中设置的,还是代码中设置的??请高手指点。<tr>
                        <td width="80" align="right" bgcolor="#FAFAFA">
                            城&nbsp;&nbsp;&nbsp;&nbsp;市:</td>
                        <td bgcolor="#FFFFFF" align="left">
                            <asp:DropDownList ID="ddCity1" runat="server">                            </asp:DropDownList>
                            <asp:DropDownList ID="ddCity2" runat="server" Width="100px">                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddCity1"
                                ErrorMessage="区域不能为空," SetFocusOnError="True" Display="Dynamic"></asp:RequiredFieldValidator>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="ddCity2"
                                ErrorMessage="地段不能为空!" SetFocusOnError="True" Display="Dynamic"></asp:RequiredFieldValidator></td>
                    </tr>

解决方案 »

  1.   

    这两个DropDownList 的数据肯定是动态加载上去的,也就是说可能是从数据库或者写代码加上去的,找找这个页面的代码文件,看看有没有加载数据的代码,替换掉就OK。
      

  2.   

    这个是上面那段代码所在文件的全部代码:
    <%@ page language="C#" autoeventwireup="true" enableeventvalidation="false" inherits="SystemManage_Company_EditCompany, WebSite" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>商家修改</title>
        <link type="text/css" rel="stylesheet" href="../images/default.Css">
    <script type="text/javascript" src="/Js/AjaxBase.js"></script>   
    <script type="text/javascript" src="/Js/Comm.js"></script>   
    <script type="text/javascript" src="/Js/valid.js"></script>   
    <script type="text/javascript" src="/ajaxpro/Web9eat.Ajax.All_Model,Ajax.ashx"></script> 
    <script type="text/javascript" src="/Js/upLoadimg.js" ></script>   
    <script  type="text/javascript" src="/Inc/Calendar/WdatePicker.js"></script>  </head>
    <body>
        <form id="form1" runat="server">
       <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F6F6F6">
            <tr>
                <td height="30" align="left" bgcolor="#F6F6F6" >
                    &nbsp;&nbsp; <asp:Label ID="labOptionTitle" runat="server" Text="Label"></asp:Label></td>
            </tr>
            <tr>
                <td align="left" valign="top" bgcolor="#FFFFFF">
                    <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#F6F6F6">
                        <tr>
                            <td width="80" align="right" bgcolor="#FAFAFA" style="width: 80px">
                                企业名称:                        </td>
                            <td bgcolor="#FFFFFF" align="left">
                                <asp:TextBox ID="txtC_name" runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic"
                                    ErrorMessage="公司名称不能空!" SetFocusOnError="True" ControlToValidate="txtC_name"></asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td width="80" align="right" bgcolor="#FAFAFA">
                                城&nbsp;&nbsp;&nbsp;&nbsp;市:</td>
                            <td bgcolor="#FFFFFF" align="left">
                                <asp:DropDownList ID="ddCity1" runat="server">                            </asp:DropDownList>
                                <asp:DropDownList ID="ddCity2" runat="server" Width="100px">                            </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddCity1"
                                    ErrorMessage="区域不能为空," SetFocusOnError="True" Display="Dynamic"></asp:RequiredFieldValidator>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="ddCity2"
                                    ErrorMessage="地段不能为空!" SetFocusOnError="True" Display="Dynamic"></asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td width="80" align="right" bgcolor="#FAFAFA">
                                地&nbsp;&nbsp;&nbsp;&nbsp;址:                        </td>
                            <td bgcolor="#FFFFFF" align="left">
                                <asp:TextBox ID="txtC_add" runat="server" Width="229px"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtC_add"
                                    ErrorMessage="地址不能为空!" SetFocusOnError="True"></asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td width="80" align="right" bgcolor="#FAFAFA">
                                电&nbsp;&nbsp;&nbsp;&nbsp;话:                        </td>
                            <td bgcolor="#FFFFFF" align="left">
                                <asp:TextBox ID="txt_tel" runat="server"></asp:TextBox>
                                &nbsp;</td>
                        </tr>
                        <tr>
                            <td width="80" align="right" bgcolor="#FAFAFA">
                                交通线路:</td>
                            <td bgcolor="#FFFFFF" align="left">
                                <asp:TextBox ID="txtC_bus" runat="server" Height="42px" TextMode="MultiLine" Width="268px"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td width="80" align="right" bgcolor="#FAFAFA">
                                经营类型:</td>
                            <td bgcolor="#FFFFFF" align="left">
                                <asp:DropDownList ID="ddCx_model" runat="server">                            </asp:DropDownList>
                                <asp:DropDownList ID="ddC_model" runat="server" Width="100px">                            </asp:DropDownList>
                                &nbsp;
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="ddCx_model"
                                    Display="Dynamic" ErrorMessage="经营类型不能为空!" SetFocusOnError="True"></asp:RequiredFieldValidator></td>
                        </tr>
                        <tr>
                            <td width="80" align="right" bgcolor="#FAFAFA">
                                经营特色:</td>
                            <td bgcolor="#FFFFFF" align="left">
                                &nbsp;                         
                                <asp:TextBox ID="txtC_ts" runat="server" Columns="30"></asp:TextBox>&nbsp;</td>
                        </tr>
                        <tr>
                            <td width="80" align="right" bgcolor="#FAFAFA">
                                就餐人数:</td>
                            <td bgcolor="#FFFFFF" align="left">
                                &nbsp;
                                <asp:TextBox ID="txtC_mans" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td width="80" align="right" bgcolor="#FAFAFA">
                                人均消费:</td>
                            <td bgcolor="#FFFFFF" align="left">
                                &nbsp;
                                <asp:DropDownList ID="ddC_money" runat="server">
                                    <asp:ListItem Value="">选择人均消费</asp:ListItem>
                                    <asp:ListItem Value="50元以下">50元以下</asp:ListItem>
                                    <asp:ListItem Value="50-100元">50-100元</asp:ListItem>
                                    <asp:ListItem Value="100-150元">100-150元</asp:ListItem>
                                    <asp:ListItem Value="150-200元">150-200元</asp:ListItem>
                                    <asp:ListItem Value="200元以上">200元以上</asp:ListItem>
                                </asp:DropDownList></td>
                        </tr>
                        ....
        </table>
            
        </form>
        
    </body>
    </html>
      

  3.   

    有兩個有關editcompany.cs文件
    1.systemmanage_company_editcompany.csusing ASP;
    using System;
    using System.Collections.Generic;
    using System.Web.Profile;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using Web9eat.BLL;
    using Web9eat.Model;
    using Web9eat.WebBase;public class SystemManage_Company_EditCompany : Page, IRequiresSessionState
    {
        private int _Id = 0;
        protected string _referrerUrl = "CompanyList.aspx";
        private All_Model bAll_Model = new All_Model();
        private C_About bC_About = new C_About();
        private Web9eat.BLL.Dns bDns = new Web9eat.BLL.Dns();
        protected Button btnOption;
        private User bUser = new User();
        protected CheckBoxList ChkC_huanjin;
        protected CheckBox chkC_isdc;
        protected CheckBox chkC_isShow360;
        protected CheckBox chkC_isvote;
        protected CheckBox chkC_order;
        protected CheckBox chkC_order_vip;
        protected CheckBox chkC_vip;
        protected DropDownList ddC_model;
        protected DropDownList ddC_money;
        protected DropDownList ddCity1;
        protected DropDownList ddCity2;
        protected DropDownList ddCx_model;
        protected HtmlForm form1;
        protected Image ImgShow;
        protected Image ImgShow1;
        protected Label ImgSize;
    .... protected void btnOption_Click(object sender, EventArgs e)
        {
    ....
    if (base.Request.Form["ddCity1"].ToString() != "")
                {
                    mC_AboutInfo.c_city = All_Model.GetModelText(Convert.ToInt32(base.Request.Form["ddCity1"].ToString()));
                }
                if (base.Request.Form["ddCity2"].ToString() != "")
                {
                    mC_AboutInfo.c_city_1 = All_Model.GetModelText(Convert.ToInt32(base.Request.Form["ddCity2"].ToString()));
                
    ....
    ....
     private void PageOnload()
        {
            IList<All_ModelInfo> All_ModelInfos = null;
            All_ModelInfos = this.bAll_Model.All_ModelInfoList_byType("city");
            this.ddCity1.Items.Clear();
            this.ddCity1.Items.Add(new ListItem("区域", ""));
            foreach (All_ModelInfo mAll_ModelInfo in All_ModelInfos)
            {
                this.ddCity1.Items.Add(new ListItem(mAll_ModelInfo.model, mAll_ModelInfo.id.ToString()));
            }
            this.ddCity1.Attributes.Add("onchange", "All_Model_OnChange(this,'" + this.ddCity2.ClientID + "')");
            this.ddCity2.Items.Clear();
            this.ddCity2.Items.Add(new ListItem("区域", ""));
            All_ModelInfos = this.bAll_Model.All_ModelInfoList_byType("jylx");
            this.ddCx_model.Items.Clear();
    ....
    -----------------------------------------------------------------------------------------
    2.usermanage_company_editcompany.csusing ASP;
    using System;
    using System.Collections.Generic;
    using System.Web.Profile;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using Web9eat.BLL;
    using Web9eat.Model;
    using Web9eat.WebBase;public class UserManage_Company_EditCompany : Page, IRequiresSessionState
    {
        private int _cId = 0;
        private string _userId = UserCookie.GetUserId();
        private All_Model bAll_Model = new All_Model();
        private C_About bC_About = new C_About();
        protected Button btnModify;
        protected CheckBoxList ChkC_huanjin;
        protected string companyId = "";
        protected DropDownList ddC_model;
        protected DropDownList ddC_money;
        protected DropDownList ddCity1;
        protected DropDownList ddCity2;
        protected DropDownList ddCx_model;
        .....
         protected void btnGoback_Click(object sender, EventArgs e)
        {
            base.Response.Redirect((string) this.ViewState["UrlReferrer"]);
        }    protected void btnModify_Click(object sender, EventArgs e)
        {
         .....
         if (mC_AboutInfo != null)
            {
                mC_AboutInfo.c_add = this.txtC_add.Text;
                mC_AboutInfo.c_bus = this.txtC_bus.Text;
                mC_AboutInfo.c_closetime = this.txtC_closetime.Text;
                mC_AboutInfo.c_mans = this.txtC_mans.Text;
                mC_AboutInfo.c_memo = this.txtC_memo.Text;
                mC_AboutInfo.c_name = this.txtC_name.Text;
                mC_AboutInfo.c_tingchewei = this.txtC_tingchewei.Text;
                mC_AboutInfo.c_url = this.txtC_url.Text;
                mC_AboutInfo.c_tel = this.txt_tel.Text;
                mC_AboutInfo.c_ts = this.txtC_ts.Text;
                if (base.Request.Form["ctl00$ContentPlaceHolder$ddCity1"].ToString() != "")
                {
                    mC_AboutInfo.c_city = All_Model.GetModelText(Convert.ToInt32(base.Request.Form["ctl00$ContentPlaceHolder$ddCity1"].ToString()));
                }
                if (base.Request.Form["ctl00$ContentPlaceHolder$ddCity2"].ToString() != "")
                {
                    mC_AboutInfo.c_city_1 = All_Model.GetModelText(Convert.ToInt32(base.Request.Form["ctl00$ContentPlaceHolder$ddCity2"].ToString()));
                }
         .....
         private void PageOnload()
        {
            IList<All_ModelInfo> All_ModelInfos = null;
            All_ModelInfos = this.bAll_Model.All_ModelInfoList_byType("city");
            this.ddCity1.Items.Clear();
            this.ddCity1.Items.Add(new ListItem("区域", ""));
            foreach (All_ModelInfo mAll_ModelInfo in All_ModelInfos)
            {
                this.ddCity1.Items.Add(new ListItem(mAll_ModelInfo.model, mAll_ModelInfo.id.ToString()));
            }
            this.ddCity1.Attributes.Add("onchange", "All_Model_OnChange(this,'" + this.ddCity2.ClientID + "')");
            this.ddCity2.Items.Clear();
            this.ddCity2.Items.Add(new ListItem("区域", ""));
            All_ModelInfos = this.bAll_Model.All_ModelInfoList_byType("jylx");
            this.ddCx_model.Items.Clear();
            this.ddCx_model.Items.Add(new ListItem("选择", ""));
            foreach (All_ModelInfo mAll_ModelInfo in All_ModelInfos)
            {
                this.ddCx_model.Items.Add(new ListItem(mAll_ModelInfo.model, mAll_ModelInfo.id.ToString()));
            }
            this.ddCx_model.Attributes.Add("onchange", "All_Model_OnChange(this,'" + this.ddC_model.ClientID + "')");
            this.ddC_model.Items.Clear();
            this.ddC_model.Items.Add(new ListItem("全部", ""));
            string[] arrXfhj = new string[] { "商务宴请", "情侣约会", "朋友聚餐", "休闲社交", "家庭聚餐", "随便吃吃" };
            for (int i = 0; i < arrXfhj.Length; i++)
            {
                this.ChkC_huanjin.Items.Add(new ListItem(arrXfhj[i], arrXfhj[i]));
            }
        }
    .....
      

  4.   

     All_ModelInfos = this.bAll_Model.All_ModelInfoList_byType("city"); 
    估计是你连数据库读数据的时候没有读到数据,最好跟一下这个方法看看
      

  5.   

    从数据库读取数据绑定到下拉框的,All_ModelInfoList_byType("city")去这个方法看看