webform2.aspx 文件:
<%@ page language="vb" autoeventwireup="false" codebehind="webform2.aspx.vb" inherits="house.webform2"%>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>webform2</title>
<meta name="generator" content="microsoft visual studio .net 7.1">
<meta name="code_language" content="visual basic .net 7.1">
<meta name="vs_defaultclientscript" content="javascript">
<meta name="vs_targetschema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body ms_positioning="gridlayout">
<form id="form1" method="post" runat="server">
<font face="宋體">
<asp:datagrid id="datagrid1"
runat="server" width="560px" height="590px" showfooter="true" autogeneratecolumns="false"
bordercolor="#336666" borderstyle="double" borderwidth="3px" backcolor="white" cellpadding="4"
gridlines="horizontal">
<selecteditemstyle font-bold="true" forecolor="white" backcolor="#339966"></selecteditemstyle>
<itemstyle forecolor="#333333" backcolor="white"></itemstyle>
<headerstyle font-bold="true" forecolor="white" backcolor="#336666"></headerstyle>
<footerstyle forecolor="#333333" backcolor="white"></footerstyle>
<columns>
<asp:templatecolumn>
<itemtemplate>
<p>
<asp:textbox id=textbox2 runat="server" height="88px" text='<% #databinder.eval(container,"dataitem.name") %>' borderstyle="none" readonly="true">
</asp:textbox></p>
<p>
<asp:hyperlink id="hyperlink2" runat="server" navigateurl='<% # "show.aspx?name=" & databinder.eval(container,"dataitem.name") %>' target="_blank">個人信息</asp:hyperlink></p>
</itemtemplate>
</asp:templatecolumn>
</columns>
<pagerstyle horizontalalign="center" forecolor="white" backcolor="#336666" mode="numericpages"></pagerstyle>
</asp:datagrid></font>
</form>
</body>
</html>
上面代碼中藍色背景是關鍵所在, navigateurl='<% # "show.aspx?name=" & databinder.eval(container,"dataitem.name") %>' 其中show.aspx 是超級鏈接所指向的頁面. name是要傳遞的
參數名(隨便取的),dataitem.name 中的name是被綁定的數據表的字段名.
在show.aspx頁面中,獲取傳遞的參數值,ok.
同樣,webform2.aspx 文件需要 webform2.aspx.vb 文件 來進行數據篩選與綁定.同
vb.net技巧之五一樣.
新聞熱點
疑難解答