473,766 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2847
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.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Sess ionState;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.H tmlControls;

namespace TestApp
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.P age
{
protected System.Web.UI.W ebControls.Pane l Panel1;
protected System.Web.UI.W ebControls.Pane l Panel2;
protected System.Web.UI.W ebControls.Pane l Panel3;
protected System.Web.UI.W ebControls.Pane l Panel4;
protected System.Web.UI.W ebControls.Drop DownList ddl1;
protected System.Web.UI.W ebControls.Drop DownList ddl2;
protected System.Web.UI.W ebControls.Drop DownList ddl4;
protected System.Web.UI.W ebControls.Drop DownList ddl3;
protected System.Web.UI.W ebControls.Butt on Button2;
protected System.Web.UI.W ebControls.Butt on Button3;
protected System.Web.UI.W ebControls.Butt on Button4;
protected System.Web.UI.W ebControls.Butt on Button1;

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
}

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

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.Button1.Cl ick += new System.EventHan dler(this.Butto n1_Click);
this.Button2.Cl ick += new System.EventHan dler(this.Butto n2_Click);
this.Button3.Cl ick += new System.EventHan dler(this.Butto n3_Click);
this.Button4.Cl ick += new System.EventHan dler(this.Butto n4_Click);
this.Load += new System.EventHan dler(this.Page_ Load);

}
#endregion

private void Button1_Click(o bject sender, System.EventArg s e)
{
Response.Write( " - ");
Response.Write( ddl1.SelectedVa lue.ToString()) ;
}

private void Button2_Click(o bject sender, System.EventArg s e)
{
Response.Write( " - ");
Response.Write( ddl2.SelectedVa lue.ToString()) ;
}

private void Button3_Click(o bject sender, System.EventArg s e)
{
Response.Write( " - ");
Response.Write( ddl3.SelectedVa lue.ToString()) ;
}

private void Button4_Click(o bject sender, System.EventArg s e)
{
Response.Write( " - ");
Response.Write( ddl4.SelectedVa lue.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
2149
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 hidden control and a placeholder control. I must generate the required number of dropdowns and the buttons dynamically based on a field value in my dataset. So I do the same in my code behind and add the generated controls to the place holder in the...
0
1552
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 add the same to the placeholder. I bind a datatable as the datasource for the dropdown. The requirement is to get the selected value in the dropdown. The problem i have here is, Since i must be able to repaint the whole control on the page, i must...
5
10841
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. I have tried setting various values to represent the default value with little success. Essentially I am looking to have the first item in the list be the default selected item. I noticed in the properties for a dtat grid you could set a default...
3
23774
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 contains a text box where users can enter a search term. A "next" button displays the following panel causing a stored procedure to populate a dropdown list. The dropdown list displays the results of the search, and requires users to select an...
1
392
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 (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,
2
8095
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 put "selected" next to the page number, as shown below: ------------------------------- <form name="pick" method="post" action="showit.php"> <select name="pggo" onChange="this.options.selected;document.pick.submit();">
1
10399
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 edit mode, everything works fine - the selected value in each list defaults to the value from the database record (selectedvalue=bind...). However, in insert mode (insertitem), it is not working. I pass in a value on the query string that I would...
6
5855
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 ID="FldType_add" Runat="server" DataSource='< %#GetFieldType()%>' DataValueField="Type" DataTextField="Type" /> Oce the page is loaded all the values are added to the dropdown list. But when I thought of getting the selected value from the...
5
7515
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 dropdownlist does not retain its selected value when I make a postback (click an update or save button). But when I run it without Tabcontrol, it's ok. Is there anything I should add to the code? Here's the aspx script: <asp:Content ID="Content2"...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9837
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.