Hi community,
i implement the CascadingDropDown code into my application and it works correct. So where is the problem ? :)
in my programm i have two aspx sites one with dropdownlist and an iframe(where the Piechart is displayed),
and a second for Piechart Drawing.
The iframe is in the updatepanel and the ImageUrl is empty
What i add to the selectindexchanged Event is a db connect with handels with the dropdownlist choise
Added Code selectindexchanged Event from the first site
Session("bezeichner") = bezeichner
Session("anzahl") = anzahl
Session("i") = i
iframe.ImageUrl = "Piechart.aspx"
Code from the second site
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim bezeichner = Session("bezeichner")
Dim anzahl = Session("anzahl")
Dim i = Session("i")
Dim count = Session("count")
CreatePie(bezeichner, anzahl, i, count)End Sub
Now i choose a item from the CascadingDropDown: the db connect process starts, the Sessionvariable gets filled and the PieChart is drawing in the iframe..
After that, i select a different item from the CascadingDropDown and "nothing" happens...to the iframe
But the Label1.Text(joe's tutorial) shows me the correct result.
So whats wrong ?
Thanks for any help!
Simon A.
Hi Simon,
I made a sample according to your description, and it worked fine.
Please try it and compare with yours:
Default.aspx
<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void Page_Load(object sender, EventArgs e) { Label1.Text = DateTime.Now.ToString(); Label2.Text = DateTime.Now.ToString(); } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Session["index"] = DropDownList1.SelectedIndex; }</script><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>Hover Sample</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><div> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" Width="188px"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> </asp:DropDownList> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> <iframe id="iframe1" runat="server" src="Default2.aspx"></iframe> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="DropDownList1" /> </Triggers> </asp:UpdatePanel> </div> </form></body></html>
Default2.aspx
<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void Page_Load(object sender, EventArgs e) { Response.Write(Session["index"].ToString()); // draw the pie based on the value of Session["index"] here }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> </div> </form></body></html>
HiRaymond,
Big thanks for your help, it works fine now!
best regards,
Simon A.
No comments:
Post a Comment