问题描述
我正从具有roomno的数据库中获取下拉列表绑定。作为textfield和guestid的值如:
roomno = 102,GuestID = 2;
romno = 103,guestid = 2;
roomno = 104,guestid = 1;
当我们将这些数据绑定到下拉列表并选择roomno:103时,它将始终选择具有相同值的第一个索引上的项目(如roomno 102和103都有相同的猜测,即2)
我如何选择具有相同值的下一个索引上的项目;
plz recommended我的任何解决方案....
i use!(回帖)在页面加载但它不起作用。
thanx提前!!! :)
i am having a drop down list bind from database having roomno. as textfield and guestid as value like :
roomno=102, GuestID=2;
romno=103, guestid=2;
roomno=104, guestid=1;
when we bind this data to drop down list and select roomno: 103 it will always select the item on first index with same value (as roomno 102 and 103 both having same guestid i.e. 2)
how do i select the item on next index having same value;
plz suggest me any solution for ds....
i use !(is post back) on pageload but it doesnt work for this.
thanx in advance!!! :)
推荐答案
ddlRoomNo.SelectedIndex = ddlRoomNo.Items.IndexOf(ddlRoomNo.Items.FindByText("103"));
这篇关于当两个具有相同值的项目时,如何从下拉列表中获取所选项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!