(一)调用链接的click事件
<script type="text/javascript">
function showMallWinodw()
{
var result=window.showModalDialog("MallWindow.aspx","","dialogWidth: 820px;dialogHeight: 600px;help:0;resizable:0;center:1;location:0;scroll:1;");
if(result!=undefined)
document.getElementById("<%=txtAccount.ClientID %>").value=result;
}
</script>
(2)在gridveiw里面定义接收的链接
<asp:HyperLink ID="lnkSelect" runat="server" NavigateUrl="#" Text="Select"></asp:HyperLink>
(3)在gridview里面写绑定
Protected Sub grid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grid.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Or e.Row.RowType = DataControlRowType.EmptyDataRow Then
Dim lnkSelect As HyperLink = e.Row.FindControl("lnkSelect")
Dim lblUserName As Label = e.Row.FindControl("lblUserName")
lnkSelect.Attributes.Add("onclick", "window.returnValue='" + lblUserName.Text.Trim() + "';window.close();")
End If
End Sub