C
Claudia Fong
HI,
I have a drop down list that I manually bond the values:
In my pageLoad I have this code
connectionInfo =
ConfigurationSettings.AppSettings["ConnectionString"];connection = new
SqlConnection(connectionInfo);
connection.Open();
Command = connection.CreateCommand();
Command.CommandText = "SELECT DISTINCT Destination.DestinationId,
Destination.DestinationName" +
" FROM Destination ";
dataReader = Command.ExecuteReader();if (dataReader.HasRows)
{
drpDestination.DataSource = dataReader;
drpDestination.DataTextField =
"DestinationName";drpDestination.DataValueField = "DestinationId";
drpDestination.DataBind();
}
dataReader.Close();
}
And then I will insert two more items in the drop down list:
protected void drpDestination_DataBound(object sender, EventArgs e)
{
drpDestination.Items.Insert(0, new ListItem("Automatic",
"0"));drpDestination.Items.Insert(1, new ListItem("Cancel Send", "1"));
}
So, my items in the ddl are: Automatic, Cancel Send, I30, K33, S30,
etc..
I'm able to select every item except the I30 which has index 2;
everytime that I select I30, it will automatically switch to Cancel
Send, index 1. I have no idea what is wrong or why it does this..
Can someone help me?
Cheers!
Claudi
I have a drop down list that I manually bond the values:
In my pageLoad I have this code
connectionInfo =
ConfigurationSettings.AppSettings["ConnectionString"];connection = new
SqlConnection(connectionInfo);
connection.Open();
Command = connection.CreateCommand();
Command.CommandText = "SELECT DISTINCT Destination.DestinationId,
Destination.DestinationName" +
" FROM Destination ";
dataReader = Command.ExecuteReader();if (dataReader.HasRows)
{
drpDestination.DataSource = dataReader;
drpDestination.DataTextField =
"DestinationName";drpDestination.DataValueField = "DestinationId";
drpDestination.DataBind();
}
dataReader.Close();
}
And then I will insert two more items in the drop down list:
protected void drpDestination_DataBound(object sender, EventArgs e)
{
drpDestination.Items.Insert(0, new ListItem("Automatic",
"0"));drpDestination.Items.Insert(1, new ListItem("Cancel Send", "1"));
}
So, my items in the ddl are: Automatic, Cancel Send, I30, K33, S30,
etc..
I'm able to select every item except the I30 which has index 2;
everytime that I select I30, it will automatically switch to Cancel
Send, index 1. I have no idea what is wrong or why it does this..
Can someone help me?
Cheers!
Claudi