Search:
Namespaces
Discussions
.NET v1.1
Feedback
Maintaining State on Control Property
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngcontrolsvb' list
.
Jay Chapman
Hey guys-
I am trying to do a simple custom web control. I want a textbox with a tag
property that maintains it's tag (if programmatically changed) between page
requests. How can I get the tag property to maintain its state?
-----------------------------------------------------
Imports System.Web.UI.WebControls
Public Class TagTextbox
Inherits
TextBox
Private strTag As
String
Public Property Tag() As
String
Get
Tag = strTag
End Get
Set(ByVal str As String)
strTag = str
End Set
End Property
End Class
----------------------------------------------
thanks,
Jay Chapman
BCA Technologies, Inc.
407.659.0653 x326
Click here to reveal e-mail address
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com
).
Version: 6.0.295 / Virus Database: 159 - Release Date: 11/1/2001
Reply to this message...
Susan Warren
Super simple, Jay:
Public Property Tag() As
String
Get
Dim o as Object =3D ViewState("tag")
If o Is Nothing Then
Return
String
.Empty
End If
Return CStr(o)
End Get
Set(ByVal str As String)
ViewState("tag") =3D str
End Set
End Property
You can also search help for "ViewState"-- there's an example the shows =
exactly this.
-----Original Message-----
From: Jay Chapman [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, November 06, 2001 2:25 PM
To: aspngcontrolsvb
Subject: [aspngcontrolsvb] Maintaining State on Control Property
Hey guys-
I am trying to do a simple custom web control. I want a textbox with a =
tag
property that maintains it's tag (if programmatically changed) between =
page
requests. How can I get the tag property to maintain its state?
-----------------------------------------------------
Imports System.Web.UI.WebControls
Public Class TagTextbox
Inherits
TextBox
Private strTag As
String
Public Property Tag() As
String
Get
Tag =3D strTag
End Get
Set(ByVal str As String)
strTag =3D str
End Set
End Property
End Class
----------------------------------------------
thanks,
Jay Chapman
BCA Technologies, Inc.
407.659.0653 x326
Click here to reveal e-mail address
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com
).
Version: 6.0.295 / Virus Database: 159 - Release Date: 11/1/2001
| [aspngcontrolsvb] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngcontrolsvb.asp
=3D JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
Reply to this message...
Jay Chapman
Susan,
thanks for the tip! That is easy. Is there much overhead associated with
doing this? I mean, should I create properties that maintain state with
reckless abandon in this way, or should it be kept to a minimum to get the
job done...?
thanks,
Jay
[Original message clipped]
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com
).
Version: 6.0.295 / Virus Database: 159 - Release Date: 11/1/2001
Reply to this message...
Susan Warren
Your users will appreciate restraint, but properties with simple types =
(ints, strings) usually don't contribute much to the bottom line, =
viewstate-wise. I'd avoid putting big, complex objects (like DataSets) =
into viewstate. But in controls we ship, most of the properties that =
are commonly set have their values round-tripped in viewstate.
hth,
Susan
-----Original Message-----
From: Jay Chapman [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, November 07, 2001 6:42 AM
To: aspngcontrolsvb
Subject: [aspngcontrolsvb] RE: Maintaining State on Control Property
Susan,
thanks for the tip! That is easy. Is there much overhead associated with
doing this? I mean, should I create properties that maintain state with
reckless abandon in this way, or should it be kept to a minimum to get =
the
job done...?
thanks,
Jay
[Original message clipped]
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com
).
Version: 6.0.295 / Virus Database: 159 - Release Date: 11/1/2001
| [aspngcontrolsvb] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngcontrolsvb.asp
=3D JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
Reply to this message...
System.String
System.Web.UI.MobileControls.TextBox
System.Web.UI.WebControls.TextBox
System.Windows.Forms.TextBox
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com