Link to home
Start Free TrialLog in
Avatar of Faye_DBA
Faye_DBA

asked on

webform.aspx does not contain the definition for DropDownlist_SelectedIndexChanged()



Based on my code when I try to view in the browser, why do I get an error message that my web page does not contain a definition for procedure:

This is a part of my web page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Wizard.aspx.cs"%>
<asp:DropDownList ID="DDArea" runat="server" Width="252px" DataTextField="AreaTypeName" DataValueField="AreaTypeCode" OnSelectedIndexChanged="DDArea_SelectedIndexChanged">
                <asp:ListItem Value="-- Choose one --" Text="-- Choose one --"></asp:ListItem>                                                        
                        <asp:ListItem Value="gv" Text="Governor"></asp:ListItem>
                        <asp:ListItem Value="se" Text="U.S. Senate"></asp:ListItem>
                        <asp:ListItem Value="cd" Text="Congressional District"></asp:ListItem>
                        <asp:ListItem Value="ss" Text="State Senate District"></asp:ListItem>
                        <asp:ListItem Value="sh" Text="State House District"></asp:ListItem>                              
       </asp:DropDownList>

Then in the code behind, I have the following code:  (Wizard.aspx.cs)
 public partial class Plugin : System.Web.UI.Page
    {
       
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (DDArea.Visible)
            {
                DDArea.AutoPostBack = true;
                DDArea.CssClass = "StandardText";
                DDDistrictOption.CssClass = "StandardText";
                           }
                 }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
           
            base.OnInit(e);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
       
        #endregion

       


        protected void DDArea_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Session["ITEMS"] = (string)Session["ITEMS"] + "6608|";
            string sValue = ((DropDownList)sender).SelectedValue;

            PoliticalGeographyWS.KeyValueObject[] kvo = null;

            PoliticalGeographyWS.SOAPAuth soapAuth = new Plugin_QuickReports_Arts.PoliticalGeographyWS.SOAPAuth();
            soapAuth.Username = Session["UserName"].ToString();
            soapAuth.Password = imapdata.CoreServices.SystemUtilities.GetApplicationConfigurationValue("WebServiceKey", true);
            PoliticalGeographyWS.PoliticalGeography pg = new Plugin_QuickReports_Arts.PoliticalGeographyWS.PoliticalGeography();
            pg.SOAPAuthValue = soapAuth;
            try
            {
                switch (sValue)
                {
                    case "State":
                        maplevel = "st";
                        kvo = pg.GetStates();
                        if (kvo != null && kvo.Length > 0)
                        {
                            DDDistrictOption.DataSource = kvo;
                            DDDistrictOption.DataTextField = "Value";
                            DDDistrictOption.DataValueField = "Key";
                            DDDistrictOption.DataBind();
                        }
                        break;
                    case "U.S. Senator":
                        maplevel = "sn";
                        string sql = "select StateName as [Key], POLY_ID + ' : ' +  [name] as Value from mgsql.V_political.dbo.USS_CY_Senators order by POLY_ID";
                        DbAccess db = new DbAccess();
                        db.ConnectionString = SystemUtilities.GetApplicationConfigurationValue("SystemDbRead", true);
                        DataSet dsSenate = db.GetDataSet(sql);
                        if (dsSenate != null && dsSenate.Tables[0].Rows.Count > 0)
                        {
                            DDDistrictOption.DataSource = dsSenate.Tables[0]; ;
                            DDDistrictOption.DataTextField = "Value";
                            DDDistrictOption.DataValueField = "Key";
                            DDDistrictOption.DataBind();
                        }
                        break;
                    case "Congressional District":
                        maplevel = "cd";
                        kvo = pg.GetCNGDistricts("");
                        if (kvo != null && kvo.Length > 0)
                        {
                            for (int i = 0; i < kvo.Length; i++)
                            {
                                string sFeatureId = kvo[i].Key; // rdr.GetValue(0).ToString();
                                string sFeatureName = kvo[i].Key;
                                sFeatureName = sFeatureName.Substring(0, 2) + sFeatureName.Substring(6, 2);
                                DDDistrictOption.Items.Add(new ListItem(sFeatureName, sFeatureId));
                            }

                        }
                        break;
                    case "State House District":
                        maplevel = "sh";
                        kvo = pg.GetSTHDistricts(null);
                        if (kvo != null && kvo.Length > 0)
                        {
                            DDDistrictOption.DataSource = kvo;
                            DDDistrictOption.DataTextField = "Key";
                            DDDistrictOption.DataValueField = "Key";
                            DDDistrictOption.DataBind();
                        }
                        break;
                    case "State Senate District":
                        maplevel = "ss";
                        kvo = pg.GetSTSDistricts(null);
                        if (kvo != null && kvo.Length > 0)
                        {
                            DDDistrictOption.DataSource = kvo;
                            DDDistrictOption.DataTextField = "Key";
                            DDDistrictOption.DataValueField = "Key";
                            DDDistrictOption.DataBind();
                        }
                        break;
                    default:
                        break;

                }
                DDDistrictOption.Items.Insert(0, new ListItem("-Select the Area-", "-1"));

                // Set the caption
                idCaption.InnerText = "Select the " + DDArea.SelectedValue + " that you want to Isolate by.";
            }
            catch (Exception ex)
            {
                IMAPLog.Error(this.GetType(), ex);
                //idMessage.Text = ex.Message;
            }

            // Set Controls visibility
            DDArea.Visible = false;
            DDDistrictOption.Visible = true;
            this.DDDistrictOption.Attributes.Add("onchange", "ZoomtoArea('" + maplevel + "');");

        }

    }
}

ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial