Dropdownlist selected index not working
Hello everyone,
I got an serious issure on my way to developing sitefinity. My dropdownlist selected index change event not working in sitefinity. While i use same code in normal page without integrating with sitefinity it works perfect. i have made usercontrol for my dropdown.
Plese suggest me the correct way.
Thanks in advance.
Dear Nrv
Having the same problem. When debugging it seems the value of the RadCombobox comes up empty
Here is my code. I actually do fill the RadCombobox from a Module from SF which does display the values correct. Since it did not work I tried with adding the heise.de link hardcoded but the e.value comes up empty as well.
protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
Response.Redirect(e.Value, true);
protected void RadComboBox1_DataBound(object sender, EventArgs e)
var combo = (RadComboBox)sender;
combo.Items.Insert(0, new RadComboBoxItem("Heise.de", "http://www.heise.de"));
combo.Items.Insert(0, new RadComboBoxItem("Quicklinks", string.Empty));
Markus, were you able to figure this out back then? I'm having the same issue but in the newer releases and i'm not sure what is going on. Any advise is appreciated! Thanks.
Dear Sharlyne
Sorry for not posting back as promissed.
I wrote in my Ticket: I did start the whole thing again and now its working. Sometimes it simply the best to delete and start new.
If I remember correct I started over and it worked then. Go figure.
Here is the code of my module. Users can simply add links with a sortvalue in a module which will be displayed on a page as dropdown (Quicklinks) on the right side http://www.golf-winterberg.ch It might help some:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuickLinks.ascx.cs" Inherits="SitefinityWebApp.UserControls.QuickLinks" %>
<
telerik:RadComboBox
ID
=
"RadComboBox2"
runat
=
"server"
DataTextField
=
"Beschreibung"
DataValueField
=
"SeitenURL"
AutoPostBack
=
"true"
Width
=
"250px"
onselectedindexchanged
=
"RadComboBox2_SelectedIndexChanged"
OnDataBound
=
"RadComboBox2_DataBound"
>
</
telerik:RadComboBox
>
using
System;
using
System.Linq;
using
Telerik.OpenAccess;
using
Telerik.Sitefinity.DynamicModules;
using
Telerik.Sitefinity.Data.Linq.Dynamic;
using
Telerik.Sitefinity.Utilities.TypeConverters;
using
Telerik.Sitefinity.GenericContent.Model;
using
Telerik.Web.UI;
using
Telerik.Sitefinity.Model;
using
System.Web;
using
System.Web.UI;
namespace
SitefinityWebApp.UserControls
public
partial
class
QuickLinks : System.Web.UI.UserControl
protected
void
Page_Load(
object
sender, EventArgs e)
if
(!Page.IsPostBack )
RetrieveCollectionOfQuicklinks();
public
void
RetrieveCollectionOfQuicklinks()
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
Type quicklinkType = TypeResolutionService.ResolveType(
"Telerik.Sitefinity.DynamicTypes.Model.Quicklinks.Quicklink"
);
// This is how we get the collection of Quicklink items
var myCollection = dynamicModuleManager.GetDataItems(quicklinkType).Where(item => item.Status == ContentLifecycleStatus.Live).OrderBy(i => i.FieldValue<
decimal
>(
"Sortierung"
));
// At this point myCollection contains the items from type quicklinkType
RadComboBox2.DataSource = myCollection;
RadComboBox2.DataBind();
protected
void
RadComboBox2_DataBound(
object
sender, EventArgs e)
var combo = (RadComboBox)sender;
combo.Items.Insert(0,
new
RadComboBoxItem(
"Quicklinks"
,
string
.Empty));
protected
void
RadComboBox2_SelectedIndexChanged(
object
sender, RadComboBoxSelectedIndexChangedEventArgs e)
Response.Redirect(e.Value,
true
);
Thanks Markus for posting back. I did finally figure it out as well. For other people, you should also try making sure the page has "viewstate" enabled. After I changed it my drop boxes worked. I was using SF5.2.