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>      
<asp:Label ID="Label2" runat="server" Text="楼栋名称:"></asp:Label>
<asp:DropDownList ID="ddl_HouseName" runat="server">
</asp:DropDownList>
     
<asp:Button ID="Btn_search" runat="server" Text="查询"
onclick="Btn_search_Click" />     
<input name="button" type="button" id="btnhouseselects" style="background:images/c3.jpg; width: 68px; height: 22px" onClick="rvID()" value="确定" />      
<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>    
<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();
}
}