本文介绍了如何在下拉列表中获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在表中有国家,我想在下拉列表中绑定国家但是默认选择的国家是表格中的用户国家...例子假设当我注册那个时候我被选中了我的国家是印度,当我然后在该下拉列表中登录所有国家/地区从数据库中获取但默认选择的国家/地区是''india''...我该怎么办?
请帮助我。
i have country in table and i want to bind country in dropdown but by default selected country is which is that user country in table...example suppose when i register that that time i was selected my country is india and when i login then in that dropdown all country fetch from database but by default selected country is ''india''...so how can i do????
plz help me.
推荐答案
//write your query here
//after that Fetch data from database and fill dataset or datatable
//It's must to fill your Country Dropdown before assigning the selected value
ddlCountry.SelectedValue=dt.rows[0]["CountryID"].ToString();
谢谢
Thanks
这篇关于如何在下拉列表中获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!