In many case, we usually want to set a default text in the first or initial load
of WebCombo based on its DataValueField.
In this topic, you will learn how to set WebCombo's value at runtime.
To set value at runtime
- Bind WebCombo
to AccessDataSource control. (Use Customers table)
- To set the Webcombo value control you need to define Value property
on Page_Load event.
protected void Page_Load(object sender, EventArgs e)
{
WebCombo1.Value = "ANATR";
}
|
- In this case, the combo text is based on one of the value ANATR,
which is Ana Trujillo.
- Run the project.