S
Showjumper
I have built a composite control that consists of a textbox and a button
that performs a whois lookup. How do i get the control to update its
appearance when in design view of a webform after a property has been
changed. I assume it has to do with creating a composite control designer
which i think i have done. Right now i am trying to just get the button text
to update once the property is changed. Any help is appreciated...
Ashok
The whoisdesigner class is below and i have <DefaultProperty("ButtonText"),
ToolboxData("<{0}:WhoIsLookup runat=server></{0}:WhoIsLookup>"),
Designer(GetType(WhoIsDesigner))> Public Class WhoIsLookup
'rest of the code is here
Public Class WhoIsDesigner
Inherits ControlDesigner
Dim WhoIsInstance As WhoIsLookup
Public Sub New()
End Sub 'New
Public Overrides Sub Initialize(ByVal component As
System.ComponentModel.IComponent)
Me.WhoIsInstance = CType(component, WhoIsLookup)
MyBase.Initialize(component)
End Sub 'Initialize
Public Overrides Function GetDesignTimeHtml() As String
Try
Dim sw As New StringWriter
Dim writer As New HtmlTextWriter(sw)
Dim SubmitButton As New Button
SubmitButton.Text = WhoIsInstance.ButtonText
WhoIsInstance.RenderControl(writer)
Return sw.ToString
Catch ex As Exception
Return Me.GetErrorDesignTimeHtml(ex)
End Try
End Function
End Class
that performs a whois lookup. How do i get the control to update its
appearance when in design view of a webform after a property has been
changed. I assume it has to do with creating a composite control designer
which i think i have done. Right now i am trying to just get the button text
to update once the property is changed. Any help is appreciated...
Ashok
The whoisdesigner class is below and i have <DefaultProperty("ButtonText"),
ToolboxData("<{0}:WhoIsLookup runat=server></{0}:WhoIsLookup>"),
Designer(GetType(WhoIsDesigner))> Public Class WhoIsLookup
'rest of the code is here
Public Class WhoIsDesigner
Inherits ControlDesigner
Dim WhoIsInstance As WhoIsLookup
Public Sub New()
End Sub 'New
Public Overrides Sub Initialize(ByVal component As
System.ComponentModel.IComponent)
Me.WhoIsInstance = CType(component, WhoIsLookup)
MyBase.Initialize(component)
End Sub 'Initialize
Public Overrides Function GetDesignTimeHtml() As String
Try
Dim sw As New StringWriter
Dim writer As New HtmlTextWriter(sw)
Dim SubmitButton As New Button
SubmitButton.Text = WhoIsInstance.ButtonText
WhoIsInstance.RenderControl(writer)
Return sw.ToString
Catch ex As Exception
Return Me.GetErrorDesignTimeHtml(ex)
End Try
End Function
End Class