<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SPBM._Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>编目系统</title></head>
<body>
<form id="form1" runat="server">
    <div>
        <table border="1" cellpadding="0" cellspacing="0" style="width: 78%; height: 324px">
            <tr>
                <td align="right" valign="top" style="width: 424px; height: 258px;">
            <iframe id="Name1" src="VideoPlayView.aspx" frameborder="0" scrolling="yes" height="450" width="420" style="height: 360px; width: 370px;"></iframe>
            </td>
                <td  rowspan="3" align="left" valign="top" style="width: 522px">
            <iframe id="Name2" src="CatalogInsertView.aspx" frameborder="0" scrolling="no" height="600" width="575" style="width: 596px; height: 558px"></iframe>
            </td>
            </tr>
            <tr>
                <td  align="right" valign="top" style="height: 144px; width: 424px;">
            <iframe id="Name3" src="WorkLanView.aspx" frameborder="0" scrolling="yes" height="425" width="420" style="height: 195px; width: 370px;"></iframe>
            </td>
            </tr>
        </table>
    </div>
</form>
</body>
</html>一个页面上放有三个Iframe <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WorkLanView.aspx.cs" Inherits="SPBM.WorkLanView" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>编目工作篮</title>
    <link href="css/StyleSheet.css" rel="Stylesheet" type="text/css" /> 
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <script src="js/common.js" type="text/javascript" ></script>
    <!-- jQuery---双色表格 -->
    <script src="js/jquery-1.2.2.js" type="text/javascript"></script> 
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="css/ui_tabs.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.2.3.pack.js" type="text/javascript"></script>
    <script src="js/ui.tabs.pack.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function() 
    {
    $('#tabs ul').tabs();
    });
    
    
</script>

<script type="text/javascript" language="javascript">

function linkProgram()
{
var id=window.document.getElementById("CheckBox1").value

    if(id==undefined)
    {
     window.alert("id-----"+id);
      return ;
    }


    window.alert("id-----"+id);
//window.parent.document.getElementById('Name2').src ="CatalogUpdateView.aspx";

}

</script>
 </head>
<body>
    <form id="form1" runat="server" class="formClass">
    <div id="content">
<!-- 标签title-->
<div id="tabs">
<ul>
            <li><a href="#fragment-1"><span>工作篮</span></a></li>
            <li><a href="#fragment-2"><span>节目树</span></a></li>
</ul>
<!-- 标签内容1-->
<div id="fragment-1">
        <table class="tableClass" border="1" cellspacing="1" style="width: 274px; height: 141px;" >
        <tbody>
    <tr>
        <td >
          <asp:GridView ID="GridView1" runat="server"
                        Height="51px"  Width="335px" AutoGenerateColumns="False"  OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDeleting="GridView1_RowDeleting" AllowPaging="True" DataKeyNames="CATALOGCODE" CellPadding="3" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" PageSize="3"   >
                        <Columns>
                        <asp:TemplateField HeaderText="序号"  >
                                <ItemTemplate>
                                <%# this.GridView1.PageIndex * this.GridView1.PageSize + this.GridView1.Rows.Count + 1%>
                                </ItemTemplate>
                            </asp:TemplateField>  
                            <asp:BoundField HeaderText="主键" DataField="CATALOGCODE"  >
                                <ItemStyle HorizontalAlign="Left" />
                            </asp:BoundField>
                            
                            
                            <asp:TemplateField HeaderText="记录">
                                <ItemTemplate>
                                    <asp:CheckBox ID="CheckBox1" runat="server"/>
                                </ItemTemplate>
                            </asp:TemplateField>
                           
                            
                            <asp:BoundField HeaderText="正题名" DataField="CATALOGNAME"  >
                                <ItemStyle HorizontalAlign="Left" />
                            </asp:BoundField>
                            <asp:BoundField HeaderText="长度" DataField="CATALOGLENGTH"  />
                            <asp:BoundField HeaderText="时间"   DataField="RECORDDATE" />
                           
                            <asp:HyperLinkField DataNavigateUrlFields="CATALOGCODE"   DataNavigateUrlFormatString="CatalogUpdateView.aspx?CATALOGCODE={0}"  
                                HeaderText="编辑"  Text="编辑" Target="_blank"   />
                                 <asp:TemplateField HeaderText="删除"   ShowHeader="False">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return confirm('您确认删除该记录吗?');"
                                             CausesValidation="False" CommandName="Delete" Text="删除"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle BackColor="White" ForeColor="#000066" />
                        <RowStyle ForeColor="#000066" />
                        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                         <PagerTemplate>
                            <table width="100%" style="font-size:12px;">
                                <tr>
                                    <td style="text-align: right">
                                        第<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'></asp:Label>页
                                        /共<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>页&nbsp;&nbsp;
                                        <asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False"
                                            CommandName="Page" Text="首页" CommandArgument="first" OnClick="btnFirst_Click">
                                        </asp:LinkButton>
                                        <asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False"
                                            CommandName="Page" Text="上一页" CommandArgument="prev" onclick="btnFirst_Click">
                                        </asp:LinkButton>
                                        <asp:LinkButton ID="btnNext" runat="server" CausesValidation="False"
                                            CommandName="Page" Text="下一页" CommandArgument="next" OnClick="btnFirst_Click">
                                        </asp:LinkButton>
                                        <asp:LinkButton ID="btnLast" runat="server" CausesValidation="False"
                                            CommandName="Page" Text="尾页" CommandArgument="last" OnClick="btnFirst_Click">
                                        </asp:LinkButton>
                                        <asp:TextBox ID="txtNewPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'
                                            Width="20px" AutoPostBack="True" ></asp:TextBox>
                                        <asp:LinkButton ID="btnGo" runat="server" CausesValidation="False" CommandArgument="go"
                                            CommandName="Page" Text="GO" OnClick="btnFirst_Click"></asp:LinkButton>
                                    </td>
                                </tr>
                            </table>
                        </PagerTemplate>
                    </asp:GridView>
                </td>
                </tr>
                <tr>
                    <td  align="left" >
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                        <asp:CheckBox ID="CheckBox2" runat="server"   AutoPostBack="True" Font-Size="9pt"  OnCheckedChanged="CheckBox2_CheckedChanged" Text="全选" />
                        <asp:Button ID="Button5" runat="server"   CssClass="button" Text="取消" OnClick="Button3_Click" />
                        <asp:Button ID="Button1" runat="server"   CssClass="button" Text="GO" OnClick="Go" OnClientClick="orderid_f()"  />
                    </td>
                </tr>
            </tbody>
            
    </table>
</div>
    </div>
    </div>
    </form>
</body>
</html>现在从上面的这个页面上往 Iframe id="Name2"上传值。现在workLanview.aspx 上使用的是 asp:gridview控件。用js得不到 id值 .

解决方案 »

  1.   

    用js得不到 id值 .??这个id值在哪里?
      

  2.   

    你把意思表达清楚
    iframe1 VideoPlayView.aspx
    iframe2 CatalogInsertView.aspx
    iframe3 WorkLanView.aspxWorkLanView.aspx中有gridview
    你想实现从gridview中取得一行的id值返回给父业面?
      

  3.   

    cyrix_wxm 三楼说的意思是对的。就是把WorkLanView.aspx中有gridview 的一个主键ID通过
    js 或者其它方法传到iframe2 CatalogInsertView.aspx页面。
      

  4.   

    iframe2.location.href="CatalogInsertView.aspx?id="
      

  5.   

     //刷新右边的IFrame页面
    function linkProgram()
    {
     
     //获得ID get Value
      var Id=document.getElementById("GridView1").value;
      alert("Id====="+Id);
      
      //传值刷新页面
     window.parent.document.getElementById('Name2').src ="CatalogUpdateView.aspx";


    }