dropdownlist value based page redirect [Resolved]

Posted by Nagukothapalli under ASP.NET on 1/6/2013 | Points: 10 | Views : 7717 | Status : [Member] | Replies : 6
how to redirect the page based on the drop down value




Responses

Posted by: Saratvaddilli on: 1/10/2013 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
Hi ,
Once check this

<script language="JavaScript" type="text/javascript">


function redirect(site){

window.location= site

}

</script>

<select onchange="redirect(this.value)">

<option value="#">Where would you like to go?</option>

<option value="http://www.Dotnetfunda.com">Google</option>

<option value="http://www.yahoo.com">Yahoo</option>

<option value="http://www.google.com">Ask</option>

</select>


Thanks and Regards
V.SaratChand
Show difficulties that how difficult you are

Nagukothapalli, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shubham on: 1/7/2013 [Member] Starter | Points: 25

Up
0
Down
hi!!!! Nagukothapalli

you have do for this
set the dropdownlist postback true!!! ok

and set the value on dropdownlist
like
if(dropdownlist1.selectedItem==page1 )
{
response.redirect("page1.aspx");
}


do like that it should work!!!!!


Thanks&Regards:-
Shubham Choudhary
Software Engineer
www.facebook.com/shubham.kunar

Nagukothapalli, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishant_Mittal on: 1/7/2013 [Member] Starter | Points: 25

Up
0
Down
<asp:DropDownList ID="ddlTest" runat="server" AutoPostBack="true" onselectedindexchanged="ddlTest_SelectedIndexChanged" 

>
<asp:ListItem Value="M">Mango</asp:ListItem>
<asp:ListItem Value="O">Orange</asp:ListItem>
<asp:ListItem Value="B">Banana</asp:ListItem>
</asp:DropDownList>


onselectedindexchanged event code to redirect on other page with selected value:-

protected void ddlTest_SelectedIndexChanged(object sender, EventArgs e)

{
Response.Redirect("RedirectPage.aspx?" + ddlTest.SelectedValue);
}


Nagukothapalli, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ankitsrist on: 1/7/2013 [Member] Starter | Points: 25

Up
0
Down
sir nice description but sir if our dropdown fetching values from DB dynamicaly so how to redirect in that case

Nagukothapalli, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: muralikrishnasurap-12704 on: 1/8/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Nagukothapalli,

We can bind text & value to dropdown list,so bind the page url as value to list item this will solve ur problem,on selectindex change get the item selected value which is nothing but page url.

Best Regards
Murali Krishna.S

Nagukothapalli, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dylanrodriguez on: 1/11/2013 [Member] Starter | Points: 25

Up
0
Down
Nice For Related To SharePoint. If yo have any question about Sharepoint Development are welcome.

http://www.aegisisc.com/sharepoint-developers.html

Thanks.

http://www.aegisisc.com/sharepoint-developers.html

Nagukothapalli, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response