SelectedValue vs SelectedItem.Value of DropDownList

后端 未结 5 1777
猫巷女王i
猫巷女王i 2020-12-08 09:37

I\'m working on an old project written and then patched by several people over the years. At some places they have used SelectedValue property and other places they used Sel

5条回答
  •  广开言路
    2020-12-08 10:32

    One important distinction between the two (which is visible in the Reflected code) is that SelectedValue will return an empty string if a nothing is selected, whereas SelectedItem.Value will throw a NullReference exception.

提交回复
热议问题