2
I have a DropDownList
with some items, and I made a click event to pick up what is selected and redirect to a page, however not working right, see:
switch(ddlMenu.SelectedValue){
case "0":
lblMensagem.Text = "Por favor, selecione uma opção valida";
break;
case "1":
Response.Redirect("/pages/cadastro.aspx");
break;
case "2":
Response.Redirect("/pages/consultas.aspx");
break;
case "3":
Response.Redirect("/pages/detalhes.aspx");
break;
}
The problem is that it only works item 0, and item 1, item 2 and item 3 the result is like item 0.
Does anyone know why it’s wrong?
I spoke in the post, only works item 0, and item 1, 2 and 3 processes the message of 0, ie when selecting 2 or 3, it is entering the action of 0.
– War Lock
Only with this excerpt you can not see any problem, it is correct. Maybe not even 0 is being done but you are not realizing.
– Maniero
@Warlock does not mean
ddlMenu.SelectedIndex
and then do theswitch
at that value (0, 1, 2, 3)?– Omni
Have you debugged? And what’s coming in
SelectedValue
?– Leonardo