复制代码 代码如下:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>弹出选择窗口</title>
<script language="javascript" type="text/javascript"><!--
function ShowDialog(ch,en,src)
{
var array=new Array();
array[0]=document.getElementById(ch);
array[1]=document.getElementById(en);
showModalDialog(src,array,"resizable:yes;");//src 为弹出页面,array 传过去的参数。
}
// --></script>
</head>
<body>
<form runat="server">
<table>
<tr>
<td> </td>
<td>中文</td>
<td>英文</td>
<td> </td>
</tr>
<tr>
<td>姓名:</td>
<td><asp:TextBox runat="server"></asp:TextBox></td>
<td><asp:TextBox runat="server"></asp:TextBox></td>
<td><input type="button" value="选择" /></td>
</tr>
</table>
</form>
</body>
</html>
复制代码 代码如下:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>框架</title>
</head>
<body>
<form runat="server">
<iframe src="GridView.aspx" src="GridView.aspx" scrolling="no" frameborder="0"></iframe>
</form>
</body>
</html>
复制代码 代码如下:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>GridView</title>
</head>
<body>
<form runat="server">
<table>
<tr>
<td>
<asp:TextBox runat="server"></asp:TextBox></td>
<td>
<asp:TextBox runat="server"></asp:TextBox></td>
<td>
<asp:Button runat="server" Text="新建" /></td>
</tr>
<tr>
<td colspan="3">
<asp:GridView runat="server" AutoGenerateColumns="False" DataKeyNames="ID" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" OnRowDeleting="GridView1_RowDeleting" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" OnSelectedIndexChanging="GridView1_SelectedIndexChanging">
<Columns>
<asp:BoundField DataField="chName" HeaderText="中文" />
<asp:BoundField DataField="enName" HeaderText="英文" />
<asp:CommandField ShowEditButton="True" >
<ControlStyle />
</asp:CommandField>
<asp:CommandField ShowSelectButton="True" />
<asp:CommandField ShowDeleteButton="True" />
</Columns>
<EmptyDataTemplate>
无数据
</EmptyDataTemplate>
<FooterStyle BackColor="Tan" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
</asp:GridView>
</td>
</tr>
</table>
</form>
</body>
</html>
复制代码 代码如下:
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
string chName = GridView1.Rows[e.NewSelectedIndex].Cells[0].Text;
string enName = GridView1.Rows[e.NewSelectedIndex].Cells[1].Text;
Response.Write("<:script language=/"javascript/">
window.dialogArguments[0].value='" + chName + "';window.dialogArguments[1].value='" + enName + "';window.close();<script>");
}
新闻热点
疑难解答
图片精选