On my page I have a dropdown list bound to a sqldatasource.
In my code behind file, on page load I am calling a method. In the method, the first thing I am doing is trying to get the selected value of my dropdown list.
For the life of me I cant figure out what is wrong and why I am getting the error 'Input string was not in a correct format.'
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
SetPeriod()
}
protected void SetPeriod()
{
int period = 0;
period = int.Parse(DDL_Period.SelectedValue);
................
}
<asp:DropDownList ID="DDL_Period" runat="server" DataSourceID="DS_Period"
DataTextField="loadLabel" DataValueField="periodId" Width="240px"
AutoPostBack= ...
Go to the complete details ...