Hi, i'm making a website with DNN and ASP.NET 2.0, and i made a CascadingDropDown with 3 dropdowns, where someone can select
- Continent
- Country
- Plant
When someone selects Continent the countries get loaded, then when someone selects country they get all the plants that exist in that country.
So far everything works, when someone selects a plant the ID of that plant needs to be submitted to another User Control with in the DNN page.
The asp.net code:
1 <%@ Control Language="C#" Inherits="COMPANY.DNN.PROJECT.Modules.PROJECTContactSelector.ViewPROJECTContactSelector"
2 CodeFile="ViewPROJECTContactSelector.ascx.cs" AutoEventWireup="true" %>
3 <%@ Register TagPrefix="dnn" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %>
4 <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
5 <div>
6 <cc1:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="ddlCriteria1"
7 Category="Criteria1" PromptText="Selecteer zoek type" ServicePath="~/DesktopModules/AJAXWebService/Locations.asmx"
8 ServiceMethod="GetCriteria1" />
9 <cc1:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="ddlCriteria2"
10 ParentControlID="ddlCriteria1" PromptText="Selecteer een item" ServiceMethod="GetCriteria2"
11 ServicePath="~/DesktopModules/AJAXWebService/Locations.asmx" Category="Criteria2" />
12 <cc1:CascadingDropDown ID="CascadingDropDown3" runat="server" TargetControlID="ddlCriteria3"
13 ParentControlID="ddlCriteria2" PromptText="Selecteer een item" ServiceMethod="GetCriteria3"
14 ServicePath="~/DesktopModules/AJAXWebService/Locations.asmx" Category="Criteria3" />
15
16 </div>
17 <div id="zoekContainer">
18 <div id="zoekDropdowns">
19 <p>
20 <asp:Label ID="lblIntroText" runat="server" resourcekey="lblIntroText"></asp:Label> <br />
21 <br />
22 <asp:Label ID="lblSearchCriteria" runat="server" resourcekey="lblSearchCriteria"></asp:Label></p>
23 <asp:DropDownList ID="ddlCriteria1" runat="server" />
24 <asp:DropDownList ID="ddlCriteria2" runat="server" />
25 <asp:DropDownList ID="ddlCriteria3" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlCriteria3_SelectedIndexChanged" />
26 </div>
27 </div>
28
The ddlCriteria3_SelectedIndexChanged code:
1 protected void ddlCriteria3_SelectedIndexChanged(object sender, EventArgs e)
2 {
3 try
4 {
5 ModuleCommunicationEventArgs MCArgs = new ModuleCommunicationEventArgs();
6 MCArgs.Sender = "ViewPROJECTContactSelector";
7 MCArgs.Target = string.Empty;
8 MCArgs.Value = ddlCriteria3.SelectedValue;
9
10 if (ModuleCommunication != null)
11 {
12 ModuleCommunication(this, MCArgs);
13 }
14
15 }
16 catch (Exception ex)
17 {
18 Exceptions.ProcessModuleLoadException(this, ex);
19 }
20 }
The catch code in the other DNN module:
1 public void OnModuleCommunication(object s, ModuleCommunicationEventArgs e)
2 {
3 if (e.Sender == "ViewPROJECTContactSelector")
4 {
5 BindData(Convert.ToInt32(e.Value));
6
7
8 }
9 }
10
The BindData function is the actual function to write the information to the screen in another section on the website.
1 private void BindData(int locationID)
2 {
3 try
4 {
5 PROJECTLocationInfoController objPROJECTLocationInfoController = new PROJECTLocationInfoController();
6 PROJECTLocationInfoInfo objPROJECTLocationInfoInfo = objPROJECTLocationInfoController.GetPROJECTLocationInfo(locationID, System.Threading.Thread.CurrentThread.CurrentCulture.ToString());
7
8 lblLocationName.Text = objPROJECTLocationInfoInfo.Name;
9 lblLocationStreet.Text = objPROJECTLocationInfoInfo.Street;
10 lblLocationHouseNr.Text = objPROJECTLocationInfoInfo.HouseNr;
11 if (objPROJECTLocationInfoInfo.AddressExtra == "")
12 {
13 lblLocationAddressExtra.Visible = false;
14 }
15 else
16 {
17 lblLocationAddressExtra.Visible = true;
18 lblLocationAddressExtra.Text = objPROJECTLocationInfoInfo.AddressExtra + "<br />";
19 }
20 lblLocationZipCode.Text = objPROJECTLocationInfoInfo.ZipCode;
21 lblLocationCity.Text = objPROJECTLocationInfoInfo.City;
22 lblLocationCountry.Text = objPROJECTLocationInfoInfo.Country;
23
24 if (objPROJECTLocationInfoInfo.Telephone == "")
25 {
26 lblLocationTelephone.Visible = false;
27 lblLocationTelephoneFront.Visible = false;
28 }
29 else
30 {
31 lblLocationTelephoneFront.Visible = true;
32 lblLocationTelephone.Visible = true;
33 lblLocationTelephone.Text = objPROJECTLocationInfoInfo.Telephone + "<br />";
34 }
35 if (objPROJECTLocationInfoInfo.Fax == "")
36 {
37 lblLocationFax.Visible = false;
38 lblLocationFaxFront.Visible = false;
39 }
40 else
41 {
42 lblLocationFaxFront.Visible = true;
43 lblLocationFax.Visible = true;
44 lblLocationFax.Text = objPROJECTLocationInfoInfo.Fax + "<br />";
45 }
46
47 lnkLocationEmail.Text = objPROJECTLocationInfoInfo.Email;
48 lnkLocationEmail.NavigateUrl = "mailto:" + objPROJECTLocationInfoInfo.Email;
49
50 lblLocationSurface.Text = objPROJECTLocationInfoInfo.Surface.ToString();
51 lblLocationEmployees.Text = objPROJECTLocationInfoInfo.Employees.ToString();
52 }
53 catch (Exception exc) //Module failed to load
54 {
55 Exceptions.LogException(exc);
56 }
57
58 }
The problem is when i run the BindData on page load then its going ok, when i debug the code all information is processed every field is filled.
But when everything is done no info is changed. I noticed a Async Postback being done after all information is processed.
I hope you guys can help me find the problem.
Kind regards,
Patrick