How to SELECT a drop down list item by value programatically in C#.NET?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
If you know that the dropdownlist contains the value you're looking to select, use:
If you're not sure if the value exists, use (or you'll get a null reference exception):
For those who come here by search (because this thread is over 3 years old):
Take a look at this article
How to select an item in a DropDownList by value Asp.Net
ddlPageSize.Items.FindByValue("25").Selected = true;
With a handy extension: