Last post Dec 09, 2013 02:45 AM by Happy Chen - MSFT
Dec 05, 2013 05:35 PM|suresh@net|LINK
I have page with couple of dropdowns and excel download button, on download button click ajax postback dropdownlist always choose first value as selected item.
But the selected item was 3. Can anyone help me to fix this.
Dec 05, 2013 06:37 PM|A2H|LINK
Ensure that you are not populating the dropdownlist on every postback.
If you are binding the dropdown on postback try to wrap the databinding code inside a !IsPostback section like given below
protected void Page_Load(object sender, EventArgs e)
//code to bind dropdown
One more suggestion is if you are using an update panel your dropdownlist should be present within that panel. This is because Selected value will only be available at the sever if the the page containing the dropdownlist control
is posted back.
Dec 05, 2013 10:58 PM|chetan.sarode|LINK
Refer this similar threads - http://forums.asp.net/t/1540056.aspx
Dec 06, 2013 05:04 AM|suresh@net|LINK
Thanks for everyone's response. I'm binding the dropdown values in (!.Postback) but still when i click on export excel button, it is taking the first value from the dropdown as seleted value and actual is different.
Dec 09, 2013 02:45 AM|Happy Chen - MSFT|LINK
you need to check out your code and make sure the dropdownlist datasource is not postback .
Can you post the complete markup or provide a simple demo, which can easily reproduce the problem?
In order to help us to understand your issue better.