Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads
 
Add your own
alternative version
Go to top

ASP.NET using GridView Control as Lookup

, 22 Nov 2008
ASP.NET using GridView control as lookup
Imports Microsoft.VisualBasic
Imports System.Web.HttpContext
Public Class Tools
    Public Shared Sub BuildLookupValueReturnControl(ByVal e As GridViewRow, ByVal LinkControlId As String)
        If e.RowType = DataControlRowType.DataRow Then
            Dim hl As New HyperLink
            Dim js As String
            hl = CType(e.FindControl(LinkControlId), HyperLink)
            js = BuildJS_ReturnLookupValue(Current.Request.QueryString("setLookupValueToControlID"), e.Cells(0).Text)
            hl.NavigateUrl = "javascript://"
            hl.Attributes.Add("onclick", js)
        End If
    End Sub
    Public Shared Function BuildJS_ReturnLookupValue(ByVal controlID As String, ByVal valueToSet As String) As String
        Dim s As String

        s = "winOpener=window.self.opener;" & _
            "winOpener.document.getElementById('" & controlID & "').value='" & valueToSet & "';" & _
            "window.close();"
        Return s
    End Function
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Amit K Bhagat
Web Developer
India India
Developer

| Advertise | Privacy | Mobile
Web01 | 2.8.140922.1 | Last Updated 23 Nov 2008
Article Copyright 2007 by Amit K Bhagat
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid