Hi,
I have a dropdown list that I have populated with a dataset.
When I load the page I want the "Detail" column in the dataset to be displayed in the text box. So if the drop down list says "down", then the text box would have text that is in the dataset that corresponds to that selection.
I will work out the part about when a user changes that selection, the text will change, but I can't seem to populate the textbox when the page loads.
Thanks,
JLC
I have a dropdown list that I have populated with a dataset.
Code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataService.DataService myData = new DataService.DataService();
DataSet domainData = myData.GetDomainData();
StatusDropDownList.DataSource = domainData.Tables[0];
StatusDropDownList.DataTextField = "Name";
StatusDropDownList.DataValueField = "ID";
StatusTextBox.Text = <-- have problem here...
//Bind the data to the control
StatusDropDownList.DataBind();
//set default selected item
StatusDropDownList.SelectedIndex = 0;
}
}
I will work out the part about when a user changes that selection, the text will change, but I can't seem to populate the textbox when the page loads.
Thanks,
JLC
Comment