DropDownList navigation

Vote:
 
Hi. I´m setting up my very first episerver site and I have ran in to some trouble. I have a MasterPage file from which I register a User Control (Inherits from EPiServer.UserControlBase). The user control contains an asp:dropdownlist (Viewstate enabled, AutoPostBack=true) from which I want to make a response.redirect on "OnSelectedIndexChanged". When I call the (for now) totally empty Template page (.aspx, inherits EPiServer.TemplatePage) who uses the masterpage file, everything works dandy, the dropdown populates with the URLs accordingly as the page_loads. But... The problem is when selecting an item in the dropdown the page just reloads with nothing else happening! Anyone got an idea of what is going on? My source code as follows... Main.Master ============== <%@ master language="C#" autoeventwireup="true" codebehind="Main.master.cs" inherits="Main.templates.MasterPages.Main" %> <%@ register tagprefix="bws" tagname="Branches" src="~/templates/Units/Branches.ascx" %> Untitled Page
Branches.ascx ============= <%@ control language="C#" autoeventwireup="true" codebehind="Branches.ascx.cs" inherits="Main.templates.Units.Branches" %> Branches.ascx.cs ============= using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using EPiServer; using EPiServer.Core; namespace Main.templates.Units { public partial class Branches : UserControlBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataBind(); ddlRegionBranches.DataValueField = "LinkURL"; ddlRegionBranches.DataTextField = "PageName"; ddlRegionBranches.DataSource = my_data_source_that_works; ddlRegionBranches.DataBind(); ddlRegionBranches.Items.Insert(0, "Välj anläggning"); ddlRegionBranches.SelectedIndex = 0; } } protected void ddlRegionBranches_SelectedIndexChanged(object sender, EventArgs e) { Response.Redirect(ddlRegionBranches.SelectedValue); } } } StartPage.aspx =============== Just an empty aspx file that inherits from EPiServer.TemplatePage Thank you! Jonas
#12841
Nov 21, 2006 14:26
Vote:
 
Put this: into your head tag in the master file. /Steve
#14976
Nov 21, 2006 23:15
Vote:
 
Thank you Steve! It works great! /Jonas
#14977
Nov 22, 2006 9:09
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.