Re: Property is loosing value

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
>>
>>
>>
>
>


.



Relevant Pages

  • Re: Property is loosing value
    ... This property is only set at design time. ... the property would need to utilize ViewState ... >> Teemu Keiski ... >>> Set(ByVal Value As String) ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • RE: Invalid_Viewstate exception with Invalid character in a Base-64 st
    ... a binary string, then the binary string is converted to safe ascii by base64 ... viewstate, though this is usually seen as an encryption error. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Calling a X.509 Auth web-service with MSXML2.HTTP from ASP Application
    ... As for the problem on posting data from ASP page to ASPNET page(through ... ASP.net PAGE will check the ViewState field when the page is posted back ... process data at the first request rather than postback. ... string username = txtUsername.Text; ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Whats the deal? (Update)
    ... and this is a reproducible issue using the dropdownlist in a webform. ... > Windowforms controls cannot be loaded directly from a datareader as ... > combobox not exist. ... >> This works great EXCEPT VB is removing the spaces from the string. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Rendern ServerControl
    ... Du brauchst eine Designer Klasse ... public override string GetDesignTimeHtml() ... > Ich habe mir ein Server Controls zusammengebaut und diese in einem eigenen ... > Die ID ist der ID Parameter welcher das Control auf meiner WebForm erhält. ...
    (microsoft.public.de.german.entwickler.dotnet.asp)