.DropDownList1.SelectedItem.Value与DropDownList1.SelectedValue是不是同一个意思
2 回答
吃鸡游戏
TA贡献1829条经验 获得超7个赞
public virtual string SelectedValue
{
get
{
int selectedIndex = this.SelectedIndex;
if (selectedIndex >= 0)
{
return this.Items[selectedIndex].Value;
}
return string.Empty;
}
}
public virtual ListItem SelectedItem
{
get
{
int selectedIndex = this.SelectedIndex;
if (selectedIndex >= 0)
{
return this.Items[selectedIndex];
}
return null;
}
}
这是反编译的结果,我想应该很明白了吧
翻翻过去那场雪
TA贡献2065条经验 获得超14个赞
不一样,
DropDownList1.SelectedItem.Value是获取静态项(手工加上去的)的Value
DropDownList1.SelectedValue 是获取那些,动态绑定后的Value
个人理解
- 2 回答
- 0 关注
- 292 浏览
添加回答
举报
0/150
提交
取消