Good morning,
With the following C # code, I generate a DropDownList.
public void CargarViaSolicitud()
{
Class.EntidadConexion cnn = new Class.EntidadConexion();
cnn.Conexion().Open();
SqlCommand cmd = new SqlCommand("Stp_Drops", cnn.Conexion());
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Opcion", SqlDbType.Int).Value = 3;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
this.ddlViaUtilizada.DataSource = dt;
this.ddlViaUtilizada.DataValueField = "ViaSolicitudId";
this.ddlViaUtilizada.DataTextField = "ViaSolicitud";
this.ddlViaUtilizada.DataBind();
cnn.Conexion().Close();
ddlViaUtilizada.Items.Insert(0, new ListItem("Seleccione Vía... "));
}
What I need is to capture that DataValue and DataText that the user selects, to send it to a table in the database.
I would appreciate your help.