Results 1 to 2 of 2

Thread: [2008] events on placeholder ddlist

  1. #1

    Thread Starter
    Fanatic Member staticbob's Avatar
    Join Date
    Jan 2005
    Location
    Manchestershire, UK Cabbage: I do
    Posts
    619

    [2008] events on placeholder ddlist

    Guys,

    I am populating a dropdownlist and adding it to a placeholder at runtime. How can I get to events of the drop down?

    Ta
    Bob
    "I dislike 7 am. If 7 am were a person, I would punch 7 am in the biscuits." - Paul Ryan, DailyRamblings

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: [2008] events on placeholder ddlist

    Add a event handler to the control as illustrated

    Code:
     protected void Page_Load(object sender, EventArgs e)
        {
            DropDownList ddl=new DropDownList();
            ddl.AutoPostBack=true;
            ddl.Items.Add("Line1");
            ddl.Items.Add("Line2");
            Panel1.Controls.Add(ddl);
            ddl.SelectedIndexChanged+=new EventHandler(ddl_SelectedIndexChanged);
          
    
        }
    
        protected void ddl_SelectedIndexChanged(object sender,EventArgs e)
        {
            Response.Write("PostBackOccurs");
        }
    Please mark you thread resolved using the Thread Tools as shown

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width