Créer une nouvelle page de fenêtre parent:
Ajouter le script suivant
La copie de code est la suivante:
<html xmlns = "http://www.w3.org/1999/xhtml">
<head runat = "server">
<Title> First </Title>
</ head>
<script type = "text / javascript">
fonction showDialog (URL)
{
var iWidth = 560; // Largeur de fenêtre modale
var iheight = 300; // hauteur de fenêtre modale
var itop = (window.screen.height-iHeight-100) / 2;
var ileft = (window.screen.width-iwidth) / 2;
var returnvalue = window.showmodaldialog (url, "Newwindow", "DialogHeight:" + iheight + "px; dialogwidth:" + iwidth + "px; barre d'outils: non; menuBar: non; billets de scroll: non; renouvelable: non; emplacement: non; statut: non: gauche: 200px; top: top: 100px;");
document.getElementById ("TextBox1"). InnerText = returnValue;
}
</cript>
<body>
<form id = "form1" runat = "server">
<input id = "Button1" type = "bouton" value = "bouton" onclick = "showDialog ('./ second.aspx')" />
<div> <asp: textbox id = "textbox1" runat = "server" width = "67px"> </ asp: textbox> </div>
</ form>
</docy>
</html>
Créer une page seconde.html:
La copie de code est la suivante:
<html xmlns = "http://www.w3.org/1999/xhtml">
<head runat = "server">
<Title> Second </Title>
<! - <base target = "_ self"> </ base> ->
</ head>
<script linguisse = "javascript">
fonction closeliag ()
{
window.opener = null;
window.close ();
}
fonction ok ()
{
var valeur = document.getElementsByName ("myradio");
pour (var i = 0; i <value.length; i ++)
{
if (valeur [i] .checked)
{
window.ReturnValue = valeur [i] .Value;
window.close ();
}
autre
{
document.getElementById ("Lab_info"). InnerText = "Aucun élément sélectionné, veuillez sélectionner!";
}
}
}
</cript>
<body>
<form id = "form1" runat = "server">
<div>
<asp: dataGrid id = "dgsjygl" runat = "server" allowpaging = "true" autogenerateColumns = "false"
Backcolor = "blanc" font-size = "9pt" pagesize = "5" width = "100%" height = "127px" onitemDatabound = "dgsjygl_itemdatabound">
<PagerStyle Mode = "NumericPages" />
<AlternativeItemStyle backcolor = "Gainsboro" />
<ItemStyle BackColor = "# Eeeeee" percolor = "Black" horizontalalign = "Center" />
<Colonnes>
<asp: templatecolumn>
<HeaderTemplate>
<étiquet> Sélectionner </Babed>
</ HeuretTemplate>
<ItemTemplate>
<input type = "radio" id = "myradio" name = "myradio" value = '<% # databinder.eval (contener.dataittem, "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>
</ Colonnes>
<HeadersTyle BackColor = "# 7481BA" percolor = "jaune" font-bold = "false" font-italic = "false" font-overline = "false" font-strikeout = "false" font-sousline = "false" font-size = "small" />
</ ASP: DataGrid>
</div>
<div>
<input id = "btn_ok" type = "bouton" onclick = "ok ()" value = "ok" />
<input id = "btn_cancel" type = "bouton" onclick = "clickDiag ()" value = "annuler" />
</div>
</ form>
</docy>
</html>
Ce qui précède consiste à implémenter cette fonction simple. Je pense qu'il devrait y avoir un moyen plus pratique. Si vous le savez, veuillez laisser un message à expliquer.