Get selected value of dropdown from panel

Discussion in 'ASP .Net' started by Andy Sutorius, Feb 23, 2005.

  1. Hi,

    I have 4 panels, each panel has a dropdown and a "next" button. I would like
    to get the selected value of the dropdown after the next button is clicked.
    I thought I could use the following (ddlChooseEmail.SelectedValue) to grab
    the value but it does not work. Is there something special about panels that
    I need to do in order to get the selected value of the dropdown?

    Thanks,

    Andy
    Andy Sutorius, Feb 23, 2005
    #1
    1. Advertising

  2. Hi,

    Eventhough you place some controls in Panels, you can directly refer from
    your code behind with, their name. There should not be a problem.


    I hope you to have a similar code as follows....

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;

    namespace TestApp
    {
    /// <summary>
    /// Summary description for WebForm1.
    /// </summary>
    public class WebForm1 : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.Panel Panel1;
    protected System.Web.UI.WebControls.Panel Panel2;
    protected System.Web.UI.WebControls.Panel Panel3;
    protected System.Web.UI.WebControls.Panel Panel4;
    protected System.Web.UI.WebControls.DropDownList ddl1;
    protected System.Web.UI.WebControls.DropDownList ddl2;
    protected System.Web.UI.WebControls.DropDownList ddl4;
    protected System.Web.UI.WebControls.DropDownList ddl3;
    protected System.Web.UI.WebControls.Button Button2;
    protected System.Web.UI.WebControls.Button Button3;
    protected System.Web.UI.WebControls.Button Button4;
    protected System.Web.UI.WebControls.Button Button1;

    private void Page_Load(object sender, System.EventArgs e)
    {
    // Put user code to initialize the page here
    }

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

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
    this.Button1.Click += new System.EventHandler(this.Button1_Click);
    this.Button2.Click += new System.EventHandler(this.Button2_Click);
    this.Button3.Click += new System.EventHandler(this.Button3_Click);
    this.Button4.Click += new System.EventHandler(this.Button4_Click);
    this.Load += new System.EventHandler(this.Page_Load);

    }
    #endregion

    private void Button1_Click(object sender, System.EventArgs e)
    {
    Response.Write(" - ");
    Response.Write(ddl1.SelectedValue.ToString());
    }

    private void Button2_Click(object sender, System.EventArgs e)
    {
    Response.Write(" - ");
    Response.Write(ddl2.SelectedValue.ToString());
    }

    private void Button3_Click(object sender, System.EventArgs e)
    {
    Response.Write(" - ");
    Response.Write(ddl3.SelectedValue.ToString());
    }

    private void Button4_Click(object sender, System.EventArgs e)
    {
    Response.Write(" - ");
    Response.Write(ddl4.SelectedValue.ToString());
    }
    }
    }


    Cheers,

    Jerome. M



    "Andy Sutorius" wrote:

    > Hi,
    >
    > I have 4 panels, each panel has a dropdown and a "next" button. I would like
    > to get the selected value of the dropdown after the next button is clicked.
    > I thought I could use the following (ddlChooseEmail.SelectedValue) to grab
    > the value but it does not work. Is there something special about panels that
    > I need to do in order to get the selected value of the dropdown?
    >
    > Thanks,
    >
    > Andy
    >
    >
    >
    =?Utf-8?B?RG90TmV0SmVyb21l?=, Feb 24, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Sutorius

    Get selected value of dropdown from panel

    Andy Sutorius, Feb 23, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    385
    Malik Asif Joyia
    Feb 24, 2005
  2. Andy Sutorius

    Get selected value of dropdown from panel

    Andy Sutorius, Feb 24, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    339
    Andy Sutorius
    Feb 24, 2005
  3. Andy Sutorius

    how to get selected value from dropdown list

    Andy Sutorius, Mar 15, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    82,362
    raouf2me
    Oct 29, 2012
  4. vishnu
    Replies:
    1
    Views:
    1,203
    Patrick.O.Ige
    Mar 25, 2006
  5. London
    Replies:
    24
    Views:
    459
    janice li
    Sep 3, 2004
Loading...

Share This Page