Hi this is the content of my ddl list: John jake jay Their id's are : john=1 , jack=2, jay=3 i want to reach two values to make this kind of statement: if (ddlnames.selectedvalue==2 || ddlnames.nextvalue==3) i want to get back jake and jay because i choose jack- the selected value in the ddl i do no know how to describe the value after it- how can I define the "nextvalue" in a code? is it ddl.selectedvalue+1?? need u quickly progfrog
VB.Net: Dim selectedNames As String selectedNames = "" If ddlnames.SelectedIndex = 1 Then selectedNames += " John" End If If ddlnames.SelectedIndex = 2 Then selectedNames += ", Jack" End If If ddlnames.SelectedIndex = 3 Then selectedNames += ", Jay" End If If selectedNames = "" Then selectedNames = "No names were selected" Else selectedNames = "Selected names: " + selectedNames End If Response.Write(selectedNames) C#: string selectedNames = null; selectedNames = ""; if (ddlnames.SelectedIndex == 1) { selectedNames += " John"; } if (ddlnames.SelectedIndex == 2) { selectedNames += ", Jack"; } if (ddlnames.SelectedIndex == 3) { selectedNames += ", Jay"; } if (string.IsNullOrEmpty(selectedNames)) { selectedNames = "No names were selected"; } else { selectedNames = "Selected names: " + selectedNames; } Response.Write(selectedNames); I think that's what you're looking for. I'm better with VB.Net than with C# but I believe my syntax is correct. -Jim