WebForm2.aspx 文件:
1@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm2.aspx.vb" Inherits="house.WebForm2"
1<html>
2<head>
3<title>WebForm2</title>
4<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"/>
5<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"/>
6<meta content="JavaScript" name="vs_defaultClientScript"/>
7<meta content=" http://schemas.microsoft.com/intellisense/ie5 " name="vs_targetSchema"/>
8</head>
9<body ms_positioning="GridLayout">
10<form id="Form1" method="post" runat="server">
11<font face="宋体">
12<asp:datagrid autogeneratecolumns="False" backcolor="White" bordercolor="#336666" borderstyle="Double" borderwidth="3px" cellpadding="4" gridlines="Horizontal" height="590px" id="DataGrid1" runat="server" showfooter="True" style="Z-INDEX: 101; LEFT: 192px; POSITION: absolute; TOP: 16px" width="560px">
13<selecteditemstyle backcolor="#339966" font-bold="True" forecolor="White"></selecteditemstyle>
14<itemstyle backcolor="White" forecolor="#333333"></itemstyle>
15<headerstyle backcolor="#336666" font-bold="True" forecolor="White"></headerstyle>
16<footerstyle backcolor="White" forecolor="#333333"></footerstyle>
17<columns>
18<asp:templatecolumn>
19<itemtemplate>
20<p>
21<asp:textbox borderstyle="None" height="88px" id="TextBox2" readonly="True" runat="server" text='```
22 #DataBinder.Eval(Container,"DataItem.name")
23```'>
24</asp:textbox></p>
25<p>
26<asp:hyperlink id="HyperLink2" navigateurl='```
27 # "show.aspx?name=" &amp; DataBinder.Eval(Container,"DataItem.name")
28```' runat="server" target="_blank">个人信息</asp:hyperlink></p>
29</itemtemplate>
30</asp:templatecolumn>
31</columns>
32<pagerstyle backcolor="#336666" forecolor="White" horizontalalign="Center" mode="NumericPages"></pagerstyle>
33</asp:datagrid></font>
34</form>
35</body>
36</html>
上面代码中蓝色背景是关键所在, NavigateUrl='```
"show.aspx?name=" & DataBinder.Eval(Container,"DataItem.name")
1参数名(随便取的), DataItem.name 中的name是被绑定的数据表的字段名.
2在show.aspx页面中,获取传递的参数值,OK.
3
4同样, **WebForm2.aspx 文件** 需要 **WebForm2.aspx.vb 文件** 来进行数据筛选与绑定.同
5VB.net技巧之五一样.