• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

not get the selectvalue in dropdown

hello,

i ask this question: http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_24991457.html#a26087358

its work well but their is a little problem .. when i select any item which are on my dropdown value then its always show me on the first value..

i print the selected item value in label on button click event..


protected void Button1_Click1(object sender, EventArgs e)
    {
            
        
        Label1.Text = ddl_customer.SelectedValue.ToString();

     }


// its always gives me the only first item value how why..

Open in new window

0
AVARICESOFT
Asked:
AVARICESOFT
  • 4
  • 4
1 Solution
 
Reza RadConsultant, TrainerCommented:
could you upload code of your page_LOAD method here
0
 
Reza RadConsultant, TrainerCommented:
I think you fill this dropdown when page loads and you don't expect IsPostBack. am I right?
if this is right you must put your fill code line inside an if like this:

if(!IsPostBack)
{
dropdown1.DataSource=something;
}
0
 
AVARICESOFTAuthor Commented:

Both DataSource and DataSourceID are defined onBoth DataSource and DataSourceID are defined on dropdownlist"



0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
AVARICESOFTAuthor Commented:
i get an error on the following: when i debug the code



"Both DataSource and DataSourceID are defined on dropdownlist"
0
 
AVARICESOFTAuthor Commented:
i get an error on the following: when i debug the code



"Both DataSource and DataSourceID are defined on dropdownlist"

ddl_customer.DataBind();
0
 
Reza RadConsultant, TrainerCommented:
bring your page_load code here for deeper consideration
0
 
AVARICESOFTAuthor Commented:
problem solved..
0
 
Reza RadConsultant, TrainerCommented:
Glad to help,
Regards,

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now