To set a default value in the DropDownList control follow the steps below.
1. Add the SetDefaultSelectItem method to the code behind file.
protected void SetDefaultSelectItem(string txtSelect) { DropDownList1.Items.FindByText(txtSelect).Selected = true; }
2. Add a condition to only set the default value on the first page load
protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) { BindCategoriesList(); SetDefaultSelectItem("Seafood"); } }3. If you run the application you will now see that "Seafood" is the default selection on the DropDownList control, when the page first load

Related Blogs:
- Bind a DataTable To A DropDownList
- (DropDownList) Setting Default Value on First Page Load
- Use The DropDownList Control To Populate GridView
- Bind DropDownList To A List Of Objects
Đặt vé máy bay tại Aivivu, tham khảo
ReplyDeleteVe may bay di My
mua vé máy bay về việt nam từ mỹ
ve may bay tư duc ve viet nam
cách mua vé máy bay từ nhật về việt nam
gia ve may bay vietjet tu han quoc ve viet nam
khi nào có chuyến bay từ canada về việt nam
chuyến bay dành cho chuyên gia