iframe外部的asp.net数据源控制参数

iframe外部的asp.net数据源控制参数,asp.net,Asp.net,希望有人能在这里帮助我,我已经寻找了几天的解决方案,但还没有找到它 我构建了一个包含2个iFrame的页面,SelectCustomer打开了一个页面,其中有一个dropdownlist,其中包含客户名称和iframecontent,我通过单击链接加载页面。此页面有一个带参数的sqldatasource。我想在这个参数中引用dropdownlist来过滤select查询,但我还没有找到一种方法来引用iframe“iframecontent”之外的dropdownlist 这是包含iFrame的页

希望有人能在这里帮助我,我已经寻找了几天的解决方案,但还没有找到它

我构建了一个包含2个iFrame的页面,SelectCustomer打开了一个页面,其中有一个dropdownlist,其中包含客户名称和iframecontent,我通过单击链接加载页面。此页面有一个带参数的sqldatasource。我想在这个参数中引用dropdownlist来过滤select查询,但我还没有找到一种方法来引用iframe“iframecontent”之外的dropdownlist


这是包含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>
<%@ 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>
<!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])) &lt; 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])) &lt; 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) &gt; 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>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200" src="WebForm2.aspx"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").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.
            $("#iframe2", parent.document).attr("src", "WebForm2.aspx?value=" + $(this).val());

            return true;
        });
    });
</script>

<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
        ddl2.SelectedValue = Request.QueryString["value"];
}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#iframe2").attr("src", "the-page-you-want-to-load-on-this-iframe");
    });
</script>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").on("change", function () {
            var iframe2BaseSrc = $("#iframe2", parent.document).attr("src");

            if (iframe2BaseSrc) {
                iframe2BaseSrc = iframe2BaseSrc.split("?")[0];

                $("#iframe2", parent.document).attr("src", iframe2BaseSrc + "?value=" + $(this).val());
            }
            return true;
        });
    });
</script>
新挑战:

<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>

openPage=$(函数(){
location.href=“Default.aspx?value=“+$(“#DropDownList1”).val();
});

解决方案之一是使用jQuery刷新第二个iframed页面,将DropDownList所选值作为其查询字符串发送(以简化操作)

为了演示,我基本上是在第二个iframed页面上更新DropDownList,但您可以轻松地适应您的需要:

主页(放置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>
<%@ 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>
<!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])) &lt; 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])) &lt; 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) &gt; 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>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200" src="WebForm2.aspx"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").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.
            $("#iframe2", parent.document).attr("src", "WebForm2.aspx?value=" + $(this).val());

            return true;
        });
    });
</script>

<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
        ddl2.SelectedValue = Request.QueryString["value"];
}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#iframe2").attr("src", "the-page-you-want-to-load-on-this-iframe");
    });
</script>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").on("change", function () {
            var iframe2BaseSrc = $("#iframe2", parent.document).attr("src");

            if (iframe2BaseSrc) {
                iframe2BaseSrc = iframe2BaseSrc.split("?")[0];

                $("#iframe2", parent.document).attr("src", iframe2BaseSrc + "?value=" + $(this).val());
            }
            return true;
        });
    });
</script>
更新#2

根据您的请求,您希望在页面加载时动态加载iframe源。 这就是你如何做到这一点:

主页(放置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>
<%@ 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>
<!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])) &lt; 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])) &lt; 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) &gt; 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>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200" src="WebForm2.aspx"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").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.
            $("#iframe2", parent.document).attr("src", "WebForm2.aspx?value=" + $(this).val());

            return true;
        });
    });
</script>

<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
        ddl2.SelectedValue = Request.QueryString["value"];
}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#iframe2").attr("src", "the-page-you-want-to-load-on-this-iframe");
    });
</script>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").on("change", function () {
            var iframe2BaseSrc = $("#iframe2", parent.document).attr("src");

            if (iframe2BaseSrc) {
                iframe2BaseSrc = iframe2BaseSrc.split("?")[0];

                $("#iframe2", parent.document).attr("src", iframe2BaseSrc + "?value=" + $(this).val());
            }
            return true;
        });
    });
</script>

$(函数(){
$(“#iframe2”).attr(“src”,“要在此iframe上加载的页面”);
});
第一个iframed页面:

<%@ 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>
<%@ 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>
<!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])) &lt; 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])) &lt; 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) &gt; 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>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200" src="WebForm2.aspx"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").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.
            $("#iframe2", parent.document).attr("src", "WebForm2.aspx?value=" + $(this).val());

            return true;
        });
    });
</script>

<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
        ddl2.SelectedValue = Request.QueryString["value"];
}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#iframe2").attr("src", "the-page-you-want-to-load-on-this-iframe");
    });
</script>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").on("change", function () {
            var iframe2BaseSrc = $("#iframe2", parent.document).attr("src");

            if (iframe2BaseSrc) {
                iframe2BaseSrc = iframe2BaseSrc.split("?")[0];

                $("#iframe2", parent.document).attr("src", iframe2BaseSrc + "?value=" + $(this).val());
            }
            return true;
        });
    });
</script>

$(函数(){
$(“#ddl1”)。关于(“更改”,函数(){
var iframe2BaseSrc=$(“#iframe2”,parent.document).attr(“src”);
if(iframe2BaseSrc){
iframe2BaseSrc=iframe2BaseSrc.split(“?”[0];
$(“#iframe2”,parent.document).attr(“src”,iframe2BaseSrc+”?value=“++$(this.val());
}
返回true;
});
});

解决方案之一是使用jQuery刷新第二个iframed页面,将DropDownList所选值作为其查询字符串发送(以简化操作)

为了演示,我基本上是在第二个iframed页面上更新DropDownList,但您可以轻松地适应您的需要:

主页(放置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>
<%@ 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>
<!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])) &lt; 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])) &lt; 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) &gt; 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>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200" src="WebForm2.aspx"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").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.
            $("#iframe2", parent.document).attr("src", "WebForm2.aspx?value=" + $(this).val());

            return true;
        });
    });
</script>

<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
        ddl2.SelectedValue = Request.QueryString["value"];
}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#iframe2").attr("src", "the-page-you-want-to-load-on-this-iframe");
    });
</script>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").on("change", function () {
            var iframe2BaseSrc = $("#iframe2", parent.document).attr("src");

            if (iframe2BaseSrc) {
                iframe2BaseSrc = iframe2BaseSrc.split("?")[0];

                $("#iframe2", parent.document).attr("src", iframe2BaseSrc + "?value=" + $(this).val());
            }
            return true;
        });
    });
</script>
更新#2

根据您的请求,您希望在页面加载时动态加载iframe源。 这就是你如何做到这一点:

主页(放置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>
<%@ 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>
<!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])) &lt; 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])) &lt; 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) &gt; 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>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200" src="WebForm2.aspx"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").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.
            $("#iframe2", parent.document).attr("src", "WebForm2.aspx?value=" + $(this).val());

            return true;
        });
    });
</script>

<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
        ddl2.SelectedValue = Request.QueryString["value"];
}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#iframe2").attr("src", "the-page-you-want-to-load-on-this-iframe");
    });
</script>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").on("change", function () {
            var iframe2BaseSrc = $("#iframe2", parent.document).attr("src");

            if (iframe2BaseSrc) {
                iframe2BaseSrc = iframe2BaseSrc.split("?")[0];

                $("#iframe2", parent.document).attr("src", iframe2BaseSrc + "?value=" + $(this).val());
            }
            return true;
        });
    });
</script>

$(函数(){
$(“#iframe2”).attr(“src”,“要在此iframe上加载的页面”);
});
第一个iframed页面:

<%@ 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>
<%@ 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>
<!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])) &lt; 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])) &lt; 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) &gt; 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>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200" src="WebForm2.aspx"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").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.
            $("#iframe2", parent.document).attr("src", "WebForm2.aspx?value=" + $(this).val());

            return true;
        });
    });
</script>

<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="true">
    <asp:ListItem Text="Option 1" Value="1"></asp:ListItem>
    <asp:ListItem Text="Option 2" Value="2"></asp:ListItem>
</asp:DropDownList>

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
        ddl2.SelectedValue = Request.QueryString["value"];
}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#iframe2").attr("src", "the-page-you-want-to-load-on-this-iframe");
    });
</script>
<iframe id="iframe1" width="500" height="200" src="WebForm1.aspx"></iframe>
<iframe id="iframe2" width="500" height="200"></iframe>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#ddl1").on("change", function () {
            var iframe2BaseSrc = $("#iframe2", parent.document).attr("src");

            if (iframe2BaseSrc) {
                iframe2BaseSrc = iframe2BaseSrc.split("?")[0];

                $("#iframe2", parent.document).attr("src", iframe2BaseSrc + "?value=" + $(this).val());
            }
            return true;
        });
    });
</script>

$(函数(){
$(“#ddl1”)。关于(“更改”,函数(){
var iframe2BaseSrc=$(“#iframe2”,parent.document).attr(“src”);
if(iframe2BaseSrc){
iframe2BaseSrc=iframe2BaseSrc.split(“?”[0];
$(“#iframe2”,parent.document).attr(“src”,iframe2BaseSrc+”?value=“++$(this.val());
}
返回true;
});
});

你就找不到办法了。提示:如果两个iframed页面在同一个域上,您可以使用Javascript来实现这一点。嗨,Melancia,您能在这里给我提供更多的细节吗。我不太擅长javascript。谢谢你,你不会找到办法的。提示:如果两个iframed页面在同一个域上,您可以使用Javascript来实现这一点。嗨,Melancia,您能在这里给我提供更多的细节吗。我不太擅长javascript。谢谢。我已经使用了您的代码,但是当我在ddl1中进行选择时,webform2.aspx页面不会刷新。我做错什么了吗?您是否在DropDownList上设置了AutoPostBack=“true”?是的,这样我就可以再看一眼。这是带有iframes的页面:此处无任何内容。请重试。我已使用了您的代码,但在ddl1中执行选择操作时,网页webform2.aspx不会刷新。我做错什么了吗?您是否在DropDownList上设置了AutoPostBack=“true”?是的,这样我就可以再看一眼。这是带有iframes的页面:此处无任何内容。再试一次。