Dropdownlist Problem

  • Thread starter Thread starter Pascal
  • Start date Start date
P

Pascal

Hi,

I have several dropdowns in my aspx-page and read the values
after I press a save-button. from these dropdowns which are filled
from database via databind() I always get the value which was selected
at page load. changes are not recognized. the dropdowns which are filled
staticly in the html, I get the right selected value.

here is my code:

public void btnSave_Click(Object sender, EventArgs e) {
ArrayList arrOrder = new ArrayList();
arrOrder.Add(ddClient.SelectedValue); -> always value "1", filled via databind()
arrOrder.Add(ddCode.SelectedValue); -> OK, filled manually
arrOrder.Add(u.getSessionValue("UserID"));
arrOrder.Add(tbClientOrderNumber.Text);
arrOrder.Add(tbNewOrderNumber.Text);
arrOrder.Add(tbProductDescription.Text);
..
..
..
}


thanx for any help
pascal
 
Hi Pascal,

(I could copy this is also another time in this newsgroup)

It sounds to me if you have not:
If not IsPostback in the load event of your page.

The load event is always processed with every send.

I hope this was the problem?

Cor
 
many thanks,

it was the postback problem.
i did not know that with an explicit button onclick-event
also the postback-event is fired.

pascal
 
all events on server controls cause postbacks, watch out for it, sometimes
its so quick when developing that you wont notice it.

Another Hint : If your dynamicly adding controls to your page, these will
have to be re-added for every postback!
 
Back
Top