AVARICESOFT
asked on
not get the selectvalue in dropdown
hello,
i ask this question: https://www.experts-exchange.com/questions/24991457/how-to-add-data-in-dropdown-using-database-using-C-net.html?anchorAnswerId=26087358#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..
i ask this question: https://www.experts-exchange.com/questions/24991457/how-to-add-data-in-dropdown-using-database-using-C-net.html?anchorAnswerId=26087358#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..
could you upload code of your page_LOAD method here
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=somet hing;
}
if this is right you must put your fill code line inside an if like this:
if(!IsPostBack)
{
dropdown1.DataSource=somet
}
ASKER
Both DataSource and DataSourceID are defined onBoth DataSource and DataSourceID are defined on dropdownlist"
ASKER
i get an error on the following: when i debug the code
"Both DataSource and DataSourceID are defined on dropdownlist"
"Both DataSource and DataSourceID are defined on dropdownlist"
ASKER
i get an error on the following: when i debug the code
"Both DataSource and DataSourceID are defined on dropdownlist"
ddl_customer.DataBind();
"Both DataSource and DataSourceID are defined on dropdownlist"
ddl_customer.DataBind();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
problem solved..
Glad to help,
Regards,
Regards,