Every time I run the following code, it keeps on saying “Input string was not in a correct format”. I have tried it two different ways, but it is still failing. How can I fix this problem?
protected void CEButton_Click(object sender, EventArgs e)
{
Session["CE"] = CEDropDownList.Text;
}
If CEDropDownList is a Dropdown contol type, you will be looking for
CEDropDownList.SelectedItem.TextSay your drop down list looks like this:
To get foo, you would use
CEDropDownList.SelectedItem.TextTo get Bar you would use
CEDropDownList.SelectedItem.Value