Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am Design One Application. To Taken One Drop Down Box, button. Then Selected Item Then Press Button Go to That Page. I am Trying But Error " Execute Child Request " So please Give For Idea To Solve This Problem.
Posted
Comments
tanweer 14-May-12 1:50am    
post your block of code where you stuck

try like this

In Aspx Page:


VB
<div>
        <asp:DropDownList ID="DropDownList1" runat="server" Height="16px" Width="66px">
            <asp:ListItem>select</asp:ListItem>
            <asp:ListItem>http://www.codeproject.com/Questions/383971/DropdownBox-Selted-item-To-NaviGated-Url</asp:ListItem>
            <asp:ListItem>http://www.google.co.in/</asp:ListItem>


        </asp:DropDownList>


        <br />
        <br />
        <br />
        <asp:Button ID="Button3" runat="server" Text="Button" />


    </div>



In CS Page:

VB
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        Response.Redirect(DropDownList1.SelectedItem.Text)
    End Sub
 
Share this answer
 
v2
Hi friend,

Try this below code...
this will solve ur probelm...


XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList runat="server" ID="DDl">
            <asp:ListItem>One</asp:ListItem>
            <asp:ListItem>Two</asp:ListItem>
            <asp:ListItem>Three</asp:ListItem>
        </asp:DropDownList>
        <br />
        <asp:Button  runat="server" ID="btnSubmit" Text="Submit"
            onclick="btnSubmit_Click"/>
    </div>
    </form>
</body>
</html>





In Code Behind U Write this Code...


C#
protected void btnSubmit_Click(object sender, EventArgs e)
   {
       if (DDl.SelectedIndex == 0)
       {
           Response.Redirect("One.aspx");
       }
       else if (DDl.SelectedIndex == 1)
       {
           Response.Redirect("Two.aspx");
       }
       else if (DDl.SelectedIndex == 2)
       {
           Response.Redirect("Three.aspx");
       }
   }
 
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