A
Anthony Judd
When I user click a link buttton i am calling a stored procedure and
provided the required parameters.
Unfortunately it seeems I can't seem to get the right selectedItem when the
page posts.
Any insight into getting around this is appreciated!!!
void new_menu_Click(object sender, EventArgs e) {
String dsn = "Initial Catalog=cms;Data Source=localhost;Integrated
Security=SSPI";
SqlConnection MyConnection = new SqlConnection(dsn);
MyConnection.Open();
SqlCommand cmd = new SqlCommand("add_menu",MyConnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@menu_name", SqlDbType.VarChar, 40).Value =
menu_name.Text;
cmd.Parameters.Add("@menu_parent", SqlDbType.Int, 4).Value =
menu_parent.SelectedItem.Value;
//always evaluates to first element despite selecting a different item.
cmd.Parameters.Add("@page_id", SqlDbType.Int, 4).Value =
page_id.SelectedItem.Value;
cmd.ExecuteNonQuery();
}
provided the required parameters.
Unfortunately it seeems I can't seem to get the right selectedItem when the
page posts.
Any insight into getting around this is appreciated!!!
void new_menu_Click(object sender, EventArgs e) {
String dsn = "Initial Catalog=cms;Data Source=localhost;Integrated
Security=SSPI";
SqlConnection MyConnection = new SqlConnection(dsn);
MyConnection.Open();
SqlCommand cmd = new SqlCommand("add_menu",MyConnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@menu_name", SqlDbType.VarChar, 40).Value =
menu_name.Text;
cmd.Parameters.Add("@menu_parent", SqlDbType.Int, 4).Value =
menu_parent.SelectedItem.Value;
//always evaluates to first element despite selecting a different item.
cmd.Parameters.Add("@page_id", SqlDbType.Int, 4).Value =
page_id.SelectedItem.Value;
cmd.ExecuteNonQuery();
}