[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-11-19
1
Medium Priority
?
947 Views
Last Modified: 2012-05-05


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 + "');");

        }

    }
}

0
Comment
Question by:Faye_DBA
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 23003984
If you look here:

<asp:DropDownList ID="DDArea" runat="server" Width="252px" DataTextField="AreaTypeName" DataValueField="AreaTypeCode" OnSelectedIndexChanged="DDArea_SelectedIndexChanged">

and here:

OnSelectedIndexChanged="DDArea_SelectedIndexChanged"

you need an event handler called 'DDArea_SelectedIndexChanged'.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month18 days, 10 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question