On Fri, 3 Mar 2006 07:25:27 -0800, DWS wrote:
Thank's for your input DWS.
Unfortunately, that won't quite do what I want.
Me.ID = "Iain" will end up in the html as something link
ID="Ctl100_Hider_Clt102_SomeContainer_Ctl100_Iain "
since the actual ID in the html depends on whereabouts in the control
hierarchy control actually is.
CLientID holds this value but it's read only.
One sort of work around is to use a named class rather than an ID based
class in the style sheet (that is add class="MyClass") and set this in the
control. This would work, but there's some risk of accidental collisions
(ID's must be unique but classes need not be).
In the end (for now, anyway), I've bypassed all the cleverness and coded up
the important bits as raw html in a literal control...
Iain
Iain,
I'm sure there is a way to change the id howabout me.id = "Iain1" but it
probably will cause problems with your control working in some environments.
A more structured design approach is to use a custom property in your
control. You get the bonus of having designer support. Make a quick change
to your prototype to include a property for the styles. Store the styles in
an enumeration. Use your new StyleType property to control the navigation
rendering.
imports system.componentmodel
<Category("Style")> _
Public Property StyleType() As st
Get
Return _StyleType
End Get
Set(ByVal value As st)
_StyleType = value
End Set
End Property
Public Enum st As Integer
Space = 1
Earth = 2
Valley = 0
End Enum
Private _StypeType As st = st.Space 'space is default in this example
...
if me.StyleType = st.Space then
' make background black have fun Iain!
...
endif
Good Luck
DWS
"Iain" wrote:
I'm writing a server control which is a navigation bar.
My prototype uses id based styles to control the layout and dynamics.
Is there any way I can override asp.net's processing of the ID so that the
ID will be the one I want regardless of the containing page and so on?
Iain
--
Iain Downs (DirectShow MVP)
Commercial Software Therapist
www.idcl.co.uk
--
Iain Downs (DirectShow MVP)
Commercial Software Therapist
www.idcl.co.uk