Crie uma nova página de janela pai:
Adicione o seguinte script
A cópia do código é a seguinte:
<html xmlns = "http://www.w3.org/1999/xhtml">
<Head Runat = "Server">
<Title> Primeiro </title>
</head>
<script type = "text/javascript">
Função ShowDialog (URL)
{
var iwidth = 560; // Largura da janela modal
var iHeight = 300; // altura da janela modal
var itop = (window.screen.Height-iHeight-100)/2;
var iLeft = (window.screen.width-iwidth)/2;
var returnValue = window.showmodaldialog (url, "newwindow", "dialogHeight:"+iHeight+"px; diálogo de diálogo:"+iwidth+"px; barra de ferramentas: não; não; esquerdo: não: não; não;
document.getElementById ("textbox1"). InnerText = returnValue;
}
</script>
<Body>
<form id = "form1" runat = "server">
<input id = "button1" type = "button" value = "button" onclick = "showdialog ('./ segundo.aspx')" />
<div> <asp: textbox id = "textbox1" runat = "server" width = "67px"> </asp: textbox> </div>
</morm>
</body>
</html>
Crie uma página Second.html:
A cópia do código é a seguinte:
<html xmlns = "http://www.w3.org/1999/xhtml">
<Head Runat = "Server">
<Title> Segundo </title>
<!-<base target = "_ Self"> </as BASE>->
</head>
<Script Language = "JavaScript">
função fechada ()
{
window.opener = null;
window.close ();
}
função ok ()
{
var value = document.getElementsByName ("myradio");
for (var i = 0; i <value.length; i ++)
{
if (valor [i].
{
window.returnValue = valor [i] .Value;
window.close ();
}
outro
{
document.getElementById ("lab_info"). InnerText = "nenhum item selecionado, selecione!";
}
}
}
</script>
<Body>
<form id = "form1" runat = "server">
<div>
<asp: datagrid id = "dgsjygl" runat = "server" allowpaging = "true" autogeneratecolumns = "false"
Backcolor = "branco" font-size = "9pt" pagageSize = "5" width = "100%" altura = "127px" oniTemdatabound = "dgsjygl_itemdatabound">
<PagersTyle Mode = "numericPages" />
<AlternatingItemstyle backcolor = "gainsboro" />
<Itemstyle backcolor = "#eeeeee" intecolor = "preto" horizontalalign = "central" />
<Columns>
<ASP: Templatecolumn>
<Headertemplate>
<bret> Selecione </elabel>
</Headertemplate>
<ItemTemplate>
<input type = "radio" id = "myradio" name = "myradio" value = '< %# databinder.eval (container.dataitem, "id") %>'>
</ItemTemplate>
<HeaderStyle font-bold = "true" horizontalalign = "center" width = "60px" />
<Itemstyle horizontalalign = "Center" />
</asp: TemplateColumn>
<ASP: BoundColumn datafield = "id" headerText = "no.">
<HeaderStyle font-bold = "true" width = "75px" Horizontalalign = "Center"/>
</asp: BoundColumn>
<ASP: BoundColumn datafield = "mc" headerText = "name">
<HeaderStyle font-bold = "true" width = "90px" Horizontalalign = "Center"/>
<Itemstyle horizontalalign = "Center" />
</asp: BoundColumn>
<ASP: BoundColumn datafield = "bt" headerText = "title">
<HeaderStyle font-bold = "true" Horizontalalign = "Center"/>
</asp: BoundColumn>
</Colunas>
<HeaderStyle backcolor = "#7481ba" ICOLOR = "AMAREL" Fonte-Bold = "False" Font-Italic = "False" Font-Overline = "False" font-strikeout = "false" font-underline = "false" font-size = "small" />
</asp: datagrid>
</div>
<div>
<input id = "btn_ok" type = "button" onclick = "ok ()" value = "ok"/>
<input id = "btn_cancel" type = "button" onclick = "clickdiag ()" value = "cancel" />
</div>
</morm>
</body>
</html>
O exposto acima tem tudo a ver com implementar essa função simples. Eu sinto que deveria haver uma maneira mais conveniente. Se você sabe, deixe uma mensagem para explicar.