标题:ASP 取值问题
只看楼主
pmayjm
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-6-6
结帖率:0
已结贴  问题点数:20 回复次数:1 
ASP 取值问题
用showModalDialog打开的模式窗口里有一个GRIDVIEW和一个确定按钮,GRIDVIEW里的CHECKBOX选上后点击确定,将GRIDVIEW里的cell[1]、cell[3]放到父窗体上,用JS实现,主要是怎么取到GRIDVIEW选定的值,和怎么显示出来!
  高手们进!

子窗体代码:
<body style="width: 692px">
  <form id="form1" runat="server">
  <div>
  <asp:Label ID="Label1" runat="server" Text="所在校区:"></asp:Label>
  <asp:DropDownList ID="ddl_AreaName" runat="server" Width="150px" AutoPostBack="True" OnSelectedIndexChanged="ddlAreaName_SelectedIndexChanged">
  </asp:DropDownList> &nbsp&nbsp&nbsp&nbsp&nbsp
  <asp:Label ID="Label2" runat="server" Text="楼栋名称:"></asp:Label>  
  <asp:DropDownList ID="ddl_HouseName" runat="server">
  </asp:DropDownList>
  &nbsp&nbsp&nbsp&nbsp&nbsp
  <asp:Button ID="Btn_search" runat="server" Text="查询"  
  onclick="Btn_search_Click" />&nbsp&nbsp&nbsp&nbsp&nbsp
  <input name="button" type="button" id="btnhouseselects" style="background:images/c3.jpg; width: 68px; height: 22px" onClick="rvID()" value="确定" /> &nbsp&nbsp&nbsp&nbsp&nbsp
  <asp:Button ID="btn_cancel" runat="server" Text="取消"  
  onclick="btn_cancel_Click" />
  </div>
  <div>
 <asp:GridView ID="gvhousetable" runat="server" AutoGenerateColumns="False" PageSize="15"  
  Width="700px" Height="400px" ForeColor="#333333"   
  onpageindexchanging="gvhousetable_PageIndexChanging" AllowPaging="True"
  onrowdatabound="gvhousetable_RowDataBound" >
  <Columns>
  <asp:TemplateField>
  <HeaderTemplate >请选择</HeaderTemplate>  
  <ItemTemplate>
  <asp:CheckBox ID="cbk" runat="server" />
  <asp:HiddenField ID="hfid" Value='<%#Eval("id") %>' runat="server" />
  </ItemTemplate>
<HeaderStyle HorizontalAlign="Center" Width="40px" />
  </asp:TemplateField>
  <asp:BoundField DataField="AreaName" HeaderText="所在校区" />
  <asp:BoundField DataField="HouseCode" HeaderText="楼栋编号" />
  <asp:BoundField DataField="HouseName" HeaderText="楼栋名称" />
   
  </Columns>
  <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
  </asp:GridView>
  </div>
  </form>
</body>

父窗体代码:
 <tr>
  <td height="25" align="right">
  房屋数据:
  </td>
  <td>&nbsp&nbsp&nbsp&nbsp   
 <b> <%--<input name="button" type="button" id="btnroomselects" style="background:images/c3.jpg; width: 68px; height: 22px" onClick="return toroomsdata()" value="选择绑定" />--%>
 <a onclick="javascript:select_flh_bdld('roomsdata.aspx');return false;" language="javascript" id="btn_bdld" class="topw" style="cursor:hand"> 选择绑定</a></b>  

   
  </td>   
  </tr>
  <tr><td></td><td height="25" align="left">
  <span id='sp'></span> <INPUT id='hd' type=hidden />
  <%--<asp:Label ID="lblareaname" runat="server" Text=" " Width=150px></asp:Label> --%> </td>
  </tr>   

父窗体JS:
function select_flh_bdld(w) {
  var str = window.showModalDialog(w, 'newwindow', "center:yes;dialogHeight:500px;dialogWidth:750px;status:no;resizable:no;scroll:yes");
  if(str==undefined)
{  
}
else
{
if(str=="")
{}
else
{
document.Form1.txt_flh.value=str.substring(0,str.indexOf("("));
document.Form1.txt_flmc.value=str.substring(str.indexOf("(")+1,str.indexOf(")"));
if(document.Form1.txt_zwmc.value=="")
{
document.Form1.txt_zwmc.value=str.substring(str.indexOf("(")+1,str.indexOf(")"));
}
document.Form1.btn_refresh.click();
}
}
搜索更多相关主题的帖子: style server asp 
2012-06-06 13:50
yms123
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:20 
模态窗口可以使用返回值来实现
比如
父窗口
<html>
 <head>
  <title>父窗口</title>
  <script language="javascript">
   function OpenModelWindow(Url)
   {
       var reVal= window.showModalDialog(Url, 'newwindow', "center:yes;dialogHeight:500px;dialogWidth:750px;status:no;resizable:no;scroll:yes");  
       alert(reVal);
   }
  </script>
 </head>
 <body>
   <input type="button" onclick="OpenModelWindow('abc.html');" value="打开一个模态窗口"/>
 </body>
</html>

abc.html
<html>
 <head>
   <title>弹出的窗口</title>
  <script language="javascript">
   function CloseWindow()
   {
        window.returnValue=document.getElementById("TestBox").value;
        window.close();
   }
  </script>
 </head>
 <body>
  <input type="text" id="TestBox" value="这里输入要在父窗口显示的内容" />
  <input type="button" onclick="CloseWindow();" value="确定" />
 </body>
</html>
2012-06-07 10:22



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-370925-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025568 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved