Select DropDownList item after declarative DataBinding
The declarative controls of ASP.NET are really great. However, there are some times, when it may not seem so.
Let’s say you have a DropDownList which is bound by a DataSource control.
Also, you have other pages hitting this page, with querystrings, and based on the item in the querystring, you’d like the to select that item.
In ASP.NET, you’d just code it, and select it after the code, or in the Pre-render event.
DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText(Request.Querystring("YourQuerystring"));
Comment (1)
you are truly a good webmaster. The web site loading pace is amazing. It kind of feels that you’re doing any unique trick. Furthermore, The contents are masterwork. you have performed a wonderful activity on this matter!