Click here to Skip to main content
15,911,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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!!! :)
Posted
Comments
sri senthil kumar 13-Mar-13 9:11am    
Can you please post the code too, so that we can help you. Hope when you process with both value and text then you can overcome this issue.

1 solution

Hello you please try this and you can get easily index of selected item if more than one items have save values.
ddlRoomNo.SelectedIndex = ddlRoomNo.Items.IndexOf(ddlRoomNo.Items.FindByText("103"));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900