473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Get selected value of dropdown from panel

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
Nov 19 '05 #1
1 2820
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kannan.M.R | last post by:
Hi, I have a problem in assigning the selected value in the dropdown to a hidden control. It goes like this. I have a repeater control. In the repeater control’s item template, I have a...
0
by: Kannan.M.R | last post by:
hi, I have a repeater. In the item template of the repeater i have a place holder control. In the item databound event of the repeater, In a for loop, i create dropdowns and buttons in a loop and...
5
by: Kris Rockwell | last post by:
Hello (again), I have gotten the dropdown list functionality to work through a few tricks (probably not the most efficient, but it works) but I am not sure how to set the default selected value....
3
by: Celine | last post by:
I have a webform with multiple panels with textboxes, dropdownlists, radiobuttonlists, etc. The user navigates through the panels and then submits the information at the end. The first panel...
1
by: Andy Sutorius | last post by:
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...
2
by: Monty | last post by:
I use a SELECT dropdown as the nav interface for jumping to a chosen page number. When I setup up the SELECT element on the page, I want to show the user the current page number they are on, so, I...
1
by: Ben | last post by:
I have a formview with a few dropdownlists (software version, database version, etc). When a software version is selected, the database version dropdownlist updates itself accordingly. When in...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
5
by: temijojo | last post by:
Hello, Can someone help me in this problem. In my content page, I used 2 user controls inside an Ajax Toolkit TabControl. One of the user controls is a data entry with a dropdownlist. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.