Click here to Skip to main content
12,698,913 members (22,814 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads


65 bookmarked

ASP.NET using GridView Control as Lookup

, 22 Nov 2008 CPOL
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 & "';" & _
        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.


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


About the Author

Amit K Bhagat
Web Developer
India India

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170118.1 | Last Updated 23 Nov 2008
Article Copyright 2007 by Amit K Bhagat
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid