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

ASP.NET using GridView Control as Lookup

, 22 Nov 2008 CPOL
ASP.NET using GridView control as lookup
Partial Class Controls_Lookup
    Inherits System.Web.UI.UserControl
    Public Property Height() As String
        Get
            Return Me.ViewState("Height")
        End Get
        Set(ByVal value As String)
            Me.ViewState("Height") = value
        End Set
    End Property

    Public Property Width() As String
        Get
            Return Me.ViewState("Width")
        End Get
        Set(ByVal value As String)
            Me.ViewState("Width") = value
        End Set
    End Property

    Public Property Url() As String
        Get
            Return Me.ViewState("Url")
        End Get
        Set(ByVal value As String)
            Me.ViewState("Url") = value
        End Set
    End Property
    Public Property LookupWindowName() As String
        Get
            Return Me.ViewState("LookupWindowName")
        End Get
        Set(ByVal value As String)
            Me.ViewState("LookupWindowName") = value
        End Set
    End Property
    Public Property ReturnToControlID() As String
        Get
            Return Me.ViewState("ReturnToControlID")
        End Get
        Set(ByVal value As String)
            Me.ViewState("ReturnToControlID") = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim sJS As String
        sJS = "javascript:w=window.open(" & _
                                """" & ResolveClientUrl(Me.Url) & "?setLookupValueToControlID=" & Me.Parent.FindControl(Me.ReturnToControlID).ClientID & """," & _
                                """" & Me.LookupWindowName & """," & _
                                """" & "location=0,status=0,scrollbars=yes,resizable=yes," & _
                                "width=" & Me.Width & ",height=" & Me.Height & """" & _
                                ");w.focus();"
        Me.Lookup.NavigateUrl = "javascript://"
        Me.Lookup.Attributes.Add("onclick", sJS)
    End Sub
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
Web02 | 2.8.141022.2 | Last Updated 23 Nov 2008
Article Copyright 2007 by Amit K Bhagat
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid