I've got a DropDown which I populate from a database. When an item is selected I want to redirect to another page with the selected id, but the problem is it passes "1" no matter what was selected.
protected void Page_Load(object sender, EventArgs e)
{
Populate();
}
public void Populate()
{
OleDbConnection con = new OleDbConnection(
"Provider=Microsoft.Jet.OLEDB.4.0; " +
"Data Source=" + Server.MapPath("connect.mdb"));
con.Open();
string strQuery = "SELECT A_ID, Title_eng FROM C_about";
OleDbCommand cmd = new OleDbCommand(strQuery, con);
OleDbDataReader reader = cmd.ExecuteReader();
titleSelection.DataSource = reader;
titleSelection.DataValueField = "A_ID";
titleSelection.DataTextField = "Title_eng";
titleSelection.DataBind();
con.Close();
con.Dispose();
}
protected void titleSelection_SelectedIndexChanged(object sender, EventArgs e)
{
string A_ID = titleSelection.SelectedValue.ToString();
Response.Redirect("aboutEdit.aspx?A_ID=" + A_ID);
}
this is the view source:
Title:
WHO WE AREWHAT WE DOPermanent PlacementsTemporary staffTraining & DevelopmentCV Writing TipsJobs Titles & DescriptionsLooking for Talent?Looking for a JobRegister