If you ask how to manually trigger an event so that it can fire any logic: not .
Event handlers must be subtle. If you need to perform one operation from several places, extract this functionality into your own method and call the event handler. For instance:
private void CountryListBox_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateStates(ListBox1.SelectedItem.Text);
}
private void UpdateStates(string country)
{
StateListBox.DataSource = GetStates(country);
StateListBox.DataBind();
}
Now, instead of triggering an event SelectedIndexChanged, you simply call the method this event handler belongs to, i.e.
private void Page_Load(object sender, EventArgs e)
{
UpdateStates("USA");
}
. , .