DropDownList.SelectedItem.Value和DropDownList.SelectedValue(ASP.NET)之间的区别 [英] Difference between DropDownList.SelectedItem.Value And DropDownList.SelectedValue (ASP.NET)

查看:234
本文介绍了DropDownList.SelectedItem.Value和DropDownList.SelectedValue(ASP.NET)之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SelctedIndexChanged 时,我收到错误,当值更改时,他给我上一个选定的值,而不是新的选定值。

I'm getting an error when SelctedIndexChanged, When the value change he gives me the previous selected value and not the new selected value.

这里有什么问题。

DropDownList.SelectedItem.Value 
DropDownList.SelectedValue


推荐答案

SelectedValues 返回selecteditem的值或,如果没有。

SelectedValues returns the Value of the selecteditem or "" if there is none.

SelectedItem 返回所选项目。 SelectedItem.Value 返回SelectedItem的.Value
。如果没有
选择的项目,则 SelectedItem.Value 将会发生错误,因为 SelectedItem 将返回null,而$ $ $ $ $ $的$ .Value将抛出错误。

SelectedItem returns the selected item. SelectedItem.Value return the .Value of the SelectedItem. SelectedItem.Value will throw an error if there is no selected item, because SelectedItem will return null, and .Value of null will throw the error.

这篇关于DropDownList.SelectedItem.Value和DropDownList.SelectedValue(ASP.NET)之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆