Re: Property is loosing value
- From: "MBO" <markus.boenke@xxxxxx>
- Date: Fri, 29 Jul 2005 09:59:51 +0200
Thanks for the answer. This property is only set at design time. I think
the implementation of the viewstate is only needed if I want to change the
value at runtime, is this correct ?
Best Regards
Markus
"Teemu Keiski" <joteke@xxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:ep6aOS3kFHA.1444@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> first of all, to keep state over postbacks (if it would be set from code),
> the property would need to utilize ViewState
>
> Property [WaitMessage]() As String
> Get
> If ViewState("WaitMessage") Is Nothing Then
> Return String.Empty
> End If
> Return Str(ViewState("WaitMessage"))
> End Get
> Set(ByVal Value As String)
> ViewState("WaitMessage") = Value
> End Set
> End Property
>
> Second, to have some sort of default tag and attributes when dragging it
> to the design surface, you could use ToolBoxData attribute within control
> class declaration
>
> for example
>
> [ ToolboxData("<{0}:MyLabel Text='MyLabel' BorderColor='Yellow'
> BackColor='Magenta' BorderWidth = '10' runat='server'></{0}:MyLabel>") ]
> public class MyLabel : Label
> {
> ...
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuitoolboxdataattributeclasstopic.asp
> (watch for wrapping)
>
> --
> Teemu Keiski
> ASP.NET MVP, AspInsider
> Finland, EU
> http://blogs.aspadvice.com/joteke
>
>
> "MBO" <markus.boenke@xxxxxx> wrote in message
> news:u4c2hc1kFHA.2904@xxxxxxxxxxxxxxxxxxxxxxx
>> Hello NG,
>>
>> I've created a custom component inherited from
>> "System.Web.UI.Webcontrold.Button" and added a new String Property
>>
>> ...
>>
>> Private _waitMessage As String
>>
>> <Bindable(True), Category("Appearance"), DefaultValue("Please Wait")>
>> Public
>> Property [WaitMessage]() As String
>>
>> Get
>> Return _waitMessage
>> End Get
>> Set(ByVal Value As String)
>> _waitMessage = Value
>> End Set
>> End Property
>>
>> ...
>>
>> If I'm using the component, I can set the property in the property
>> editor,
>> but when I built the project it is set back to an empty string. I found
>> out
>> that when I add the component the following code is added to the webform:
>>
>> ...
>>
>> <cc1:PleaseWaitButton id="PleaseWaitButton1" style="Z-INDEX: 101; LEFT:
>> 392px; POSITION: absolute; TOP: 208px"
>> runat="server" Text="Search" Width="440px"
>> Height="128px"></cc1:PleaseWaitButton>
>>
>> ...
>>
>> It seems that the "WaitMessage" attribute is missing, if I manually add
>> the
>> attribute like
>>
>>
>> <cc1:PleaseWaitButton id="PleaseWaitButton1" style="Z-INDEX: 101; LEFT:
>> 392px; POSITION: absolute; TOP: 208px"
>> runat="server" Text="Search" WaitMessage="Please Wait" Width="440px"
>> Height="128px"></cc1:PleaseWaitButton>
>>
>> ...
>>
>> the probelm is solved, the property holds its value also when I build the
>> project.
>>
>> What do I need to change in the property or component, that the
>> "WaitMessage" attribute is inserted automatically when I insert the
>> component to a webform ?
>>
>> Thanks and Regards
>>
>> MBO
>>
>>
>>
>
>
.
- Follow-Ups:
- Re: Property is loosing value
- From: Teemu Keiski
- Re: Property is loosing value
- References:
- Property is loosing value
- From: MBO
- Re: Property is loosing value
- From: Teemu Keiski
- Property is loosing value
- Prev by Date: ComponentArt vs. r.a.d. controls - which is best?
- Next by Date: Re: changing z-index. help!!
- Previous by thread: Re: Property is loosing value
- Next by thread: Re: Property is loosing value
- Index(es):
Relevant Pages
|