本文介绍了DrpDownList SelectedIndex问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里ddlMachinayName是一个dropdownList。以下两个代码是否给出相同的答案?
ddlMachinayName.SelectedIndex = -1;
ddlMachinayName.SelectedIndex = 0;
Here ddlMachinayName is a dropdownList. Are the below two codes give the same answer ?
ddlMachinayName.SelectedIndex = -1;
ddlMachinayName.SelectedIndex = 0;
推荐答案
Quote:
DropDownList控件中所选项的索引。默认值为0,它选择列表中的第一项。
DropDownList控件中项目的索引从零开始。
The index of the selected item in the DropDownList control. The default value is 0, which selects the first item in the list.
The indexes for the items in the DropDownList control are zero-based.
因此,-1和0都会产生相同的结果。
So, both the -1 and 0 will result the same.
这篇关于DrpDownList SelectedIndex问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!