Can I have a webcontrol push an image

Discussion in 'ASP .Net Web Controls' started by GADOI, Apr 14, 2008.

  1. GADOI

    GADOI Guest

    Hello:
    The objective is a dll with embeded images that when the dll is called from
    an aspx web page, it returns a table with pictures. So, I do not want to
    call the image from the aspx web page but rather have the dll push the image
    to the web page.

    When I attempt to reference the image from the dll (WebControl) I get the
    error: Object reference not set to an instance of an object.
    The imge Help.gif is embeded and is located in a folder called Images.
    ===================================================================
    Imports System
    Imports System.Collections.Generic
    Imports System.ComponentModel
    Imports System.Text
    Imports System.Web
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    <Assembly:
    WebResource("GAINSCOMwebdocument.WebDocumentControl.Images.Help.gif",
    "img/gif")>
    <DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1
    runat=server></{0}:WebCustomControl1>")> _
    Public Class WebDocumentControl
    Inherits WebControl
    <Bindable(True), Category("Appearance"), DefaultValue(""),
    Localizable(True)> Property Text() As String
    Get
    Dim s As String = CStr(ViewState("Text"))
    If s Is Nothing Then
    Return String.Empty
    Else
    Dim Var_ImageUrl As String = ""
    Dim Var_Error As String = ""
    Try
    Var_ImageUrl =
    Page.ClientScript.GetWebResourceUrl(GetType(System.String),
    "GAINSCOMwebdocument.WebDocumentControl.Images.Help.gif")
    Catch ex As Exception
    Var_Error = ex.Message
    End Try

    Return "<table bgcolor='#78987'><tr><td>" + s + "</td><td>"
    + Var_Error + "</td><td><img src='" + Var_ImageUrl + "'></td></tr></table>"
    End If
    End Get

    Set(ByVal Value As String)
    ViewState("Text") = Value
    End Set
    End Property
    Protected Overrides Sub RenderContents(ByVal output As HtmlTextWriter)
    output.Write(Text)
    End Sub
    ===================================================================
    Any thoughts ?
    Thanks
     
    GADOI, Apr 14, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    2
    Views:
    757
  2. XyZaa
    Replies:
    0
    Views:
    604
    XyZaa
    Jul 19, 2007
  3. Luis Ramírez.

    Can a webcontrol (webcontrol.dll) have a configuration file?

    Luis Ramírez., Jul 5, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    222
    Luis Ramírez
    Jul 6, 2004
  4. Kasabaarde Sumta

    WebControl inside of WebControl and attaching events

    Kasabaarde Sumta, Dec 13, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    215
    Kasabaarde Sumta
    Dec 13, 2004
  5. samppi
    Replies:
    27
    Views:
    553
    David A. Black
    Dec 5, 2007
Loading...

Share This Page