Is it possible to bind a textbox on a webform to some field in my database
cause I can't get it 2 work. I binded a list of country to a dropdownlist,
now all I need is that everytime my users select a country the prefix of the
selected country is loaded in my textbox, I could do this in a normal
windows form but cannot do it in a webform. Am i missing something.
this is my code to bind data to my drop down list.
private void Page_Load(object sender, System.EventArgs e)
{
if (!(IsPostBack))
{
String sConn = "Provider = Microsoft.Jet.OleDb.4.0;Data
Source=c:\\db1.mdb";
OleDbConnection con1 = new OleDbConnection(sConn);
con1.Open();
OleDbDataAdapter adp1 = new OleDbDataAdapter("select * from
country",con1);
DataSet ds = new DataSet();
//
adp1.TableMappings.Add("Table","Country");
adp1.Fill(ds);
DropDownList1.DataSource = ds;
DropDownList1.DataTextField = "Name";
DropDownList1.DataValueField = "Code";
DropDownList1.DataBind();
con1.Close();
}
}
Thanks Ivan
Ivan