if set selectedindex
of combobox in onload
method, text inside combobox gets selected well.
protected override void onload(eventargs e) { base.onload(e); combobox.items.add("zero"); combobox.items.add("one"); combobox.items.add("two"); combobox.selectedindex = 2; }
if use onshown
method setting selectedindex works expected:
protected override void onshown(eventargs e) { base.onshown(e); combobox.selectedindex = 2; }
why happen , how can avoid behavior? inside usercontrol, there no onshown method can used. therefore workaround won't work custum usercontrol.
if don't want focus
combo box change focus other control.
like
textbox1.select();
Comments
Post a Comment