誰かがここで私を助けてくれることを願っています.数日間解決策を探していましたが、見つかりませんでした.
私は2つのiframeを含むページを作成しました.SelectCustomerはドロップダウンリストが顧客名で表示されるページを開き、iframecontentはリンクをクリックしてページをロードします. このページには、パラメーターを持つ sqldatasource があります。このパラメータでドロップダウンリストを参照して選択クエリをフィルタリングしたいのですが、iframe「iframecontent」の外でドロップダウンリストを参照する方法が見つかりません。
これは、iframe を含むページです。
<%@ Page Title="" Language="VB" MasterPageFile="~/Dashboard/Sales/Dashboard_Sales.master" AutoEventWireup="false" CodeFile="Index.aspx.vb" Inherits="Dashboard_Sales_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<iframe
name="SelectCustomer"
src="SelectDebiteur.aspx"
align="top"
frameborder="0"
height="50"
width="100%"
marginheight="0"
marginwidth="0"
scrolling="auto">
</iframe>
<iframe
name="iframecontent"
height="500"
width="100%">
</iframe>
</body>
</html>
</asp:Content>
これは最初の iframe のページです。
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SelectDebiteur.aspx.vb" Inherits="Dashboard_Sales_SelectDebiteur" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#DropDownList1").on("change", function () {
// When the DropDownList selected value has been changed,
// refresh the other iframed page changing its source
// adding the value as its query string.
$("#iframecontent", parent.document).attr("src", "Default.aspx?value=" + $(this).val());
return true;
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="ListDebiteur" runat="server" ConnectionString="<%$ ConnectionStrings:FLOSConnectionString2 %>" SelectCommand="SELECT [aa-270].cddeb, [ba-001].naamorg AS Debiteur FROM [aa-270] INNER JOIN [ba-001] ON [aa-270].cdorg = [ba-001].cdorg ORDER BY Debiteur"></asp:SqlDataSource>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="ListDebiteur" DataTextField="Debiteur" DataValueField="cddeb">
</asp:DropDownList>
</div>
</form>
</body>
</html>
これは、2 番目の iframe に読み込まれるページです。
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="ListCustomers" runat="server" ConnectionString="<%$ ConnectionStrings:FLOSConnectionString2 %>" SelectCommand="SELECT [aa-270].cddeb, [ba-001].naamorg AS Debiteur FROM [aa-270] INNER JOIN [ba-001] ON [aa-270].cdorg = [ba-001].cdorg ORDER BY Debiteur"></asp:SqlDataSource>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" DataSourceID="ListCustomers" DataTextField="Debiteur" DataValueField="cddeb">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:FLOSConnectionString2 %>" SelectCommand="SELECT [va-211].cdorg, [ba-001].naamorg, RTRIM(YEAR([va-211].[datum-lvoor])) + '-' + CASE WHEN RTRIM(MONTH([va-211].[datum-lvoor])) < 10 THEN '0' + RTRIM(MONTH([va-211].[datum-lvoor])) ELSE RTRIM(MONTH([va-211].[datum-lvoor])) END AS Maand, SUM(CASE WHEN [va-211].cdstatus = 'O' THEN [va-211].aanttelev * ([va-211].prijs / [bb-063].prijsper) WHEN [va-211].cdstatus = 'A' THEN [va-211].aantgelev * ([va-211].prijs / [bb-063].prijsper) END) AS Omzet FROM [ba-001] INNER JOIN [va-211] ON [ba-001].cdorg = [va-211].cddeb LEFT OUTER JOIN [bb-063] ON [va-211].cdprodukt = [bb-063].cdprodukt WHERE ([bb-063].cdprijssrt = 'VERK') AND ([va-211].cdstatus = 'O' OR [va-211].cdstatus = 'A') GROUP BY [ba-001].naamorg, RTRIM(YEAR([va-211].[datum-lvoor])) + '-' + CASE WHEN RTRIM(MONTH([va-211].[datum-lvoor])) < 10 THEN '0' + RTRIM(MONTH([va-211].[datum-lvoor])) ELSE RTRIM(MONTH([va-211].[datum-lvoor])) END, [va-211].cdorg HAVING (SUM(CASE WHEN [va-211].cdstatus = 'O' THEN [va-211].aanttelev * ([va-211].prijs / [bb-063].prijsper) WHEN [va-211].cdstatus = 'A' THEN [va-211].aantgelev * ([va-211].prijs / [bb-063].prijsper) END) > 0) AND ([va-211].cdorg = @param1) ORDER BY Maand, [ba-001].naamorg">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList2" Name="param1" PropertyName="Text" DefaultValue="00000739" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" EnableModelValidation="True" ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="cdorg" HeaderText="cdorg" SortExpression="cdorg" />
<asp:BoundField DataField="naamorg" HeaderText="naamorg" SortExpression="naamorg" />
<asp:BoundField DataField="Maand" HeaderText="Maand" ReadOnly="True" SortExpression="Maand" />
<asp:BoundField DataField="Omzet" HeaderText="Omzet" ReadOnly="True" SortExpression="Omzet" />
</Columns>
<EditRowStyle BackColor="#7C6F57" />
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#E3EAEB" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
</asp:GridView>
</div>
</form>
</body>
</html>
そして、それはページの背後にあるコードです:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Dashboard_Sales_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
DropDownList2.SelectedValue = Request.QueryString["value"];
}
}
新しい挑戦:
<a href="javascript:openPage()" target="iframecontent">Omzet in portefeuille </a> </li>
<scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
type="text/javascript"></script>
<script type="text/javascript">
openPage = $(function () {
location.href = "Default.aspx?value=" + $("#DropDownList1").val();
});
</script>