本文介绍了如何代表会话从数据库中获取选定值到下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要代表Session将我的下拉列表与来自数据库的选定值绑定.
假设数据库中有一个列名称"Country",当用户单击"Edit Buton"时,我要选择他在注册过程中插入的"Users Selected Country".如果他想更改为他的国家,我也想向所有国家展示.
请帮助我,他们非常紧急. :(
I want To Bind My dropdownlist with the selected value coming from database on the behalf of Session.
suppose there is a Column name Country in the Database and when user Click on Edit Buton then i want Selected Country of User Which he inserted During Registration. and i also want to show All countries too if he wants to change to his Country.
Plz help me Guys Its Very Urgent. :(
推荐答案
DropDownList1.SelectedValue = DropDownList1.Items.FindByText(dr["CountryName"].ToString()).Value;
这篇关于如何代表会话从数据库中获取选定值到下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!