I am using Convert.ToInt32(ddlBuyer1Country.SelectedValue); to typecast a string returned by selectedvalue.
But this is giving me 0 instead of 3. I have selected value as 3 in this case.
I am using Convert.ToInt32(ddlBuyer1Country.SelectedValue) ; to typecast a string returned by selectedvalue. But this
Share
Try:
Int.TryParse(ddlBuyer1Country.SelectedValue, out myInt);But double check to make sure that you are not re-binding the dropdown on postback, that could reset your selected value to 0. Make sure the dropdown bind only occurs in a: