CascadingDropDown - can't read SelectedValue

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
8/26/2011 11:00:53 AM
Gravatar
Total Posts 3

CascadingDropDown - can't read SelectedValue

Hi all!

Have created a control with the ISettingControl interface, consisting of three CascadingDropDown controls, which I need to use on the UserProfile, essentially:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="LycknisSubjectSelect.ascx.vb"
    Inherits="acme.Web.UI.LycknisSubjectSelect" %>
<%@ Register TagPrefix="e37" Namespace="acme.Web.UI" Assembly="acme.Web.UI" %>

        <div class="settingrow">
        <e37:NoValidationDropDown ID="DropDownMain" runat="server" AutoPostBack="true"></e37:NoValidationDropDown>
            <ajaxToolkit:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="DropDownMain"
                ServicePath="~/Webservices/loadSubjects.asmx" ServiceMethod="GetSubjectMain" Category="SubjectMain"
                PromptText="Välj huvudämne" LoadingText="Hämtar ämnen">
            </ajaxToolkit:CascadingDropDown>
        </div>
        <div class="settingrow">
        <e37:NoValidationDropDown ID="DropDownSub1" runat="server"></e37:NoValidationDropDown>
            <ajaxToolkit:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="DropDownSub1"
                ServicePath="~/Webservices/loadSubjects.asmx" ServiceMethod="GetSubjectSub1" ParentControlID="DropDownMain"
                Category="SubjectSub1" PromptText="Välj Underämne 1" LoadingText="Hämtar ämnen">
            </ajaxToolkit:CascadingDropDown>
        </div>
        <div class="settingrow">
        <e37:NoValidationDropDown ID="DropDownSub2" runat="server"></e37:NoValidationDropDown>
            <ajaxToolkit:CascadingDropDown ID="CascadingDropDown3" runat="server" TargetControlID="DropDownSub2"
                ServicePath="~/Webservices/loadSubjects.asmx" ServiceMethod="GetSubjectSub2" ParentControlID="DropDownSub1"
                Category="SubjectSub2" PromptText="Välj Underämne 2" LoadingText="Hämtar ämnen">
            </ajaxToolkit:CascadingDropDown>
        </div>

 

To avoid the problem with "Invalid postback", I created a custom class for DropDown:

Namespace acme.Web.UI
    Public Class NoValidationDropDown
        Inherits System.Web.UI.WebControls.DropDownList
    End Class
End Namespace

In my ascx.vb I can set the initial value of the drop-downs without any problem, in the ISettingControl region, Sub SetValue, I just set the value of CascadingDropDown1.SelectedValue

But, I have not succeeded reading the values of the drop-downs. Have tried in the Get function, page_load... but nothing. As soon as the user clicks the Update-button I only get an empty value.

Has anyone else done the same thing and succeeded? If so, how?

Regards,

//Bjorn

8/26/2011 11:16:20 AM
Gravatar
Total Posts 18439

Re: CascadingDropDown - can't read SelectedValue

I think I would wrap all that inside an updatepanel so that the postback doesn't affect the rest of the page. These usercontrols are loaded dynamically and the timing of events may mean something is not getting initialized correctly in your control on postback as it reloads the control it is losing state. I would set breakpoints in the code and step through it both during non postback and during postback to find out exactly what is happening and at what point in the request.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.