|
-
May 10th, 2004, 08:15 AM
#1
Thread Starter
Frenzied Member
Repaint/Rerender Control in IDE
I have a custom phone control consisting of 3 textboxes.
Two of the textboxes are created in the constructor and the third textbox is optional, depending on whether the developer wants the control to handle international numbers.
There is a boolean property (ShowCountryCode), which determines whether the country code textbox will be displayed.
The problem I am having with this is when the control is placed on the form it shows the two default textboxes, the ShowCountryCode property is set to False by default, but if the developer sets the ShowCountryCode property to True. I want the control to re-render/repaint itself in the IDE to show three textboxes instead of the default two.
It renders just fine at run-time, but not in design time in the IDE.
Anyone know how to repaint/re-render a control in the IDE, based on a properties setting???
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
May 13th, 2004, 05:35 PM
#2
I wonder how many charact
Seems to me the answer lies in the IDesigner you attach to the class...
The IDesigner is ultimately what is responsible for the look of the control at design time.
Really, all you do is override the DesignTimeHTML, and for your purpose, you would check the Designer's property and if it was 3 textboxes, you would append another input into the html.
http://msdn.microsoft.com/library/de...gnersample.asp
http://msdn.microsoft.com/library/de...orwebforms.asp
Last edited by nemaroller; May 13th, 2004 at 05:41 PM.
-
May 13th, 2004, 05:46 PM
#3
I wonder how many charact
Here's a sample from my own DateTime picker control... now I only do something really simple which is get the width... but you're supposed to use .IsItemDirty or something.. but I never bothered to learn that much 
VB Code:
<DefaultProperty("Text"), DesignerAttribute(GetType(CESICalendarDesigner), GetType(IDesigner)), ToolboxData(" <{0}:CESIDateTimePicker runat=server></{0}:CESIDateTimePicker>")> _
Public Class CESIDateTimePicker
.....
End Class
''''''Here is the designer class that you make an instance of your
'''''class declared above, and mess with its properties. I delcared this following class in the same .vb file after End Class of my control above.
''''notice how I convert the designer's component property into my control, and access its current Width.
Public Class CESICalendarDesigner
Inherits System.Web.UI.Design.ControlDesigner
Private myDT As CESIDateTimePicker
Public Overrides Function GetDesignTimeHtml() As String
Dim r As CESIDateTimePicker = CType(Me.Component, CESIDateTimePicker)
Dim s1 As String = "<table bgcolor=#FFFFFF height=5px border=1 cellpadding=0 cellspacing=0 width="
Dim s2 As String = "><tr><td> </td></tr></table>"
s1 = String.Concat(s1, r.Width.ToString)
Return String.Concat(s1, s2)
End Function
Public Overrides Sub Initialize(ByVal component As System.ComponentModel.IComponent)
myDT = DirectCast(component, CESIDateTimePicker)
MyBase.Initialize(component)
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|