R
reidarT
I am filling a combobox with data from a table.
This is done with the code below.
After update of the combobox I want to fill txtField2 with data from Field2
in the select-statement.
How can I do that?
private void Page_Load(object sender, System.EventArgs e)
{
if (! Page.IsPostBack)
{
InitiateInstitution();
}
}
public void InitiateInstitution()
{
connName.Open();
SqlCommand cmd = new SqlCommand("SELECT Field1, Field2, Field3 FROM
tblInstitution ORDER BY Field1", connName);
SqlDataReader dr = cmd.ExecuteReader();
cboInstitution.DataSource = dr;
cboInstitution.DataTextField = "Field1";
cboInstitution.DataBind();
dr.Close();
connName.Close();
}
regards
reidarT
This is done with the code below.
After update of the combobox I want to fill txtField2 with data from Field2
in the select-statement.
How can I do that?
private void Page_Load(object sender, System.EventArgs e)
{
if (! Page.IsPostBack)
{
InitiateInstitution();
}
}
public void InitiateInstitution()
{
connName.Open();
SqlCommand cmd = new SqlCommand("SELECT Field1, Field2, Field3 FROM
tblInstitution ORDER BY Field1", connName);
SqlDataReader dr = cmd.ExecuteReader();
cboInstitution.DataSource = dr;
cboInstitution.DataTextField = "Field1";
cboInstitution.DataBind();
dr.Close();
connName.Close();
}
regards
reidarT