Property not set on postback

Discussion in 'ASP .Net Building Controls' started by Chris Kennedy, Jul 18, 2005.

  1. I have a very basic control. In the ChildControls I have added a
    response.write to write a property I have set. I does it on the first
    display but when I press the added button control it doesn't write anything.
    Can anyone help?

    Namespace nscontrols
    Public Class clscontrol : Inherits System.Web.UI.WebControls.WebControl

    Implements INamingContainer
    Dim btn as new button()
    Dim _location as string
    Public Property Location as String

    Get

    Return _location

    End Get
    Set
    _location = Value.ToString()
    End Set
    End Property


    Protected Overrides Sub CreateChildControls()
    System.Web.HttpContext.Current.Response.Write(_location)

    btn.id = "btn"
    btn.text = "test"
    Controls.add(btn)
    End sub

    End class
    End Namespace
     
    Chris Kennedy, Jul 18, 2005
    #1
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.