Click here to Skip to main content
14,368,155 members
Rate this:
Please Sign up or sign in to vote.
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!!! :)
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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"));

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100