New Control won't drop on designer page

Discussion in 'ASP .Net Building Controls' started by jsh02_nova@hotmail.com, Dec 14, 2004.

  1. Guest

    Made new control as perscibed by MS web documentation, added control to
    toolbar, but control can't be dragged unto new web page.
    What ComponentModel Designer property tags did I forget to include?
    , Dec 14, 2004
    #1
    1. Advertising

  2. Guest

    Code posting:
    Imports System
    Imports System.Text
    Imports System.ComponentModel
    Imports System.ComponentModel.Design
    Imports System.Web.UI
    Imports System.Web.UI.Design.ControlDesigner
    Imports System.Web.UI.WebControls

    <Assembly: TagPrefix("CustomControl", "CustomControl")>

    Namespace Common
    <Description("Displays details of element"), _
    ToolboxData("<{0}:ElementDetail Text=""Element Detail Table""
    runat=server ></{0}:ElementDetail>"), _
    Designer("CustomControl.Common.ElementDetailDesigner")> _
    Public Class ElementDetail : Inherits WebControl

    #Region " Properties "
    <Browsable(True), Category("Behavior"), Bindable(True),
    DefaultValue("2"), Description("Table cellspacing")> _
    Property Cellspacing() As Integer
    Get
    Dim i As Integer = CType(ViewState("Cellspacing"), Integer)
    Return CType(IIf(i.Equals(Nothing), CType("2", Object), CType(i,
    Object)), Integer)
    End Get
    Set(ByVal Value As Integer)
    ViewState("Cellspacing") = Value
    End Set
    End Property

    #End Region

    #Region " Overrides "

    'Adds attributes to HTML tag
    Protected Overrides Sub AddAttributesToRender(ByVal writer As
    System.Web.UI.HtmlTextWriter)
    MyBase.AddAttributesToRender(writer)
    writer.AddAttribute("InsId", InsId.Trim)
    writer.AddAttribute("TypId", TypId.Trim)
    writer.AddAttribute("ShowNulls", ShowNulls.ToString)
    writer.AddAttribute("ShowZeros", ShowZeros.ToString)
    If Cellspacing > 0 Then
    writer.AddAttribute("Cellspacing", Cellspacing.ToString)
    End If
    If Wrap Then
    writer.AddAttribute("Wrap", Wrap.ToString)
    End If

    writer.RenderBeginTag(HtmlTextWriterTag.Span)
    writer.RenderEndTag()
    End Sub


    Protected Overrides Sub RenderContents(ByVal writer As
    System.Web.UI.HtmlTextWriter)
    writer.WriteLine("<p><h3>Detail</h3><p>")
    writer.WriteLine("<table border=""0"" cellspacing=" &
    Cellspacing.ToString & ">")
    writer.WriteLine("<tr>")
    writer.WriteLine("<td span=2><font face=""Arial""
    size=""3""><b>Properties:</b></font></td>")
    writer.WriteLine("</tr>")
    writer.WriteLine("<tr valign=top>")
    writer.WriteLine("<td valign=top><font face=""Arial""
    size=""2""><b>DisplayName</b></font></td>")
    writer.WriteLine("<td valign=top><font face=""Arial""
    size=""2"">DisplayValue&nbsp;</font></td>")
    writer.WriteLine("</tr>")
    'finish table
    writer.WriteLine("</table>")
    End Sub

    Protected Overrides Function CreateControlCollection() As
    System.Web.UI.ControlCollection
    Return New EmptyControlCollection(Me)
    End Function

    #End Region
    End Class

    Public Class ElementDetailDesigner
    Inherits System.Web.UI.Design.ControlDesigner

    Public Overrides Function GetDesignTimeHtml() As String
    Return "<p>ElementDetail/p><hr/><hr/>"
    End Function

    End Class

    End Namespace
    , Dec 15, 2004
    #2
    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. SirPoonga
    Replies:
    2
    Views:
    738
    Ben Strackany
    Jan 7, 2005
  2. Chad
    Replies:
    4
    Views:
    8,308
  3. Steve B.
    Replies:
    4
    Views:
    946
    Cheryl D Wise
    Jun 1, 2007
  4. John Saunders

    New Version of Custom Control Not Seen by Designer (but page sees it)

    John Saunders, Jul 13, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    113
    John Saunders
    Jul 13, 2003
  5. Andrea Williams

    Custom control won't drag and drop to page

    Andrea Williams, Mar 29, 2005, in forum: ASP .Net Building Controls
    Replies:
    10
    Views:
    242
Loading...

Share This Page