.NETGURU
Stylesheet settings within a custom web control
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcontrolsvb' list.


Raj Sharma
-- Copied from [aspngvb] to [aspngcontrolsvb] by Sheik Yerbouti --This is a multi-part message in MIME format.------=_NextPart_000_000F_01C158C5.665BAC10Content-Type: multipart/alternative;    boundary="----=_NextPart_001_0010_01C158C5.665BAC10"------=_NextPart_001_0010_01C158C5.665BAC10Content-Type: text/plain;    charset="us-ascii"Content-Transfer-Encoding: 7bit Hi,Does anybody have any idea how to pick up stylesheet settings from thecontaining page within a web control?I am attempting create a new control for use on asp.net pages, but don'tknow how to dynamically change the appearance of the UI by gettingstylesheet info. Note that the stylesheet name and location will beunknown to the control as it could be placed on any page, so I can'thardcode this.Has anyone got a useful beta 2 control sample in VB? Regards, Raj Sharma ------=_NextPart_001_0010_01C158C5.665BAC10Content-Type: text/html;    charset="us-ascii"Content-Transfer-Encoding: quoted-printable<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =xmlns:o=3D"urn:schemas-microsoft-com:office:office" =xmlns:w=3D"urn:schemas-microsoft-com:office:word" =xmlns=3D"http://www.w3.org/TR/REC-html40";><head><META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =charset=3Dus-ascii"><meta name=3DProgId content=3DWord.Document><meta name=3DGenerator content=3D"Microsoft Word 10"><meta name=3DOriginator content=3D"Microsoft Word 10"><link rel=3DFile-List href=3D"cid:filelist.xml@01C158C5.47BB1890"><!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:DoNotRelyOnCSS/> </o:OfficeDocumentSettings></xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:SpellingState>Clean</w:SpellingState> <w:DocumentKind>DocumentEmail</w:DocumentKind> <w:EnvelopeVis/> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument></xml><![endif]--><style><!-- /* Font Definitions */ @font-face    {font-family:Helvetica;    panose-1:2 11 6 4 2 2 2 2 2 4;    mso-font-charset:0;    mso-generic-font-family:swiss;    mso-font-pitch:variable;    mso-font-signature:536902279 -2147483648 8 0 511 0;}@font-face    {font-family:Verdana;    panose-1:2 11 6 4 3 5 4 4 2 4;    mso-font-charset:0;    mso-generic-font-family:swiss;    mso-font-pitch:variable;    mso-font-signature:536871559 0 0 0 415 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal    {mso-style-parent:"";    margin-top:0cm;    margin-right:0cm;    mso-margin-bottom-alt:auto;    margin-left:0cm;    mso-pagination:widow-orphan;    font-size:10.0pt;    font-family:Helvetica;    mso-fareast-font-family:"Times New Roman";    color:#FFFFCC;    mso-believe-normal-left:yes;}a:link, span.MsoHyperlink    {color:blue;    text-decoration:underline;    text-underline:single;}a:visited, span.MsoHyperlinkFollowed    {color:purple;    text-decoration:underline;    text-underline:single;}p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig    {margin:0cm;    margin-bottom:.0001pt;    mso-pagination:widow-orphan;    font-size:12.0pt;    font-family:"Times New Roman";    mso-fareast-font-family:"Times New Roman";    color:windowtext;}p    {mso-margin-top-alt:auto;    margin-right:0cm;    mso-margin-bottom-alt:auto;    margin-left:0cm;    mso-pagination:widow-orphan;    font-size:10.0pt;    font-family:Helvetica;    mso-fareast-font-family:"Times New Roman";    color:#FFFFCC;}span.EmailStyle17    {mso-style-type:personal-compose;    mso-style-noshow:yes;    mso-ansi-font-size:10.0pt;    mso-bidi-font-size:10.0pt;    font-family:Verdana;    mso-ascii-font-family:Verdana;    mso-hansi-font-family:Verdana;    color:windowtext;    mso-text-animation:none;    font-weight:normal;    font-style:normal;    text-decoration:none;    text-underline:none;    text-decoration:none;    text-line-through:none;}span.SpellE    {mso-style-name:"";    mso-spl-e:yes;}@page Section1    {size:612.0pt 792.0pt;    margin:72.0pt 90.0pt 72.0pt 90.0pt;    mso-header-margin:35.4pt;    mso-footer-margin:35.4pt;    mso-paper-source:0;}div.Section1    {page:Section1;}--></style><!--[if gte mso 10]><style> /* Style Definitions */=20 table.MsoNormalTable    {mso-style-name:"Table Normal";    mso-tstyle-rowband-size:0;    mso-tstyle-colband-size:0;    mso-style-noshow:yes;    mso-style-parent:"";    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;    mso-para-margin:0cm;    mso-para-margin-bottom:.0001pt;    mso-pagination:widow-orphan;    font-size:10.0pt;    font-family:"Times New Roman";}</style><![endif]--><![if mso 9]><style>p.MsoNormal    {margin-left:18.75pt;}</style><![endif]><!--[if gte mso 9]><xml> <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /></xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--></head><body bgcolor=3Dwhite background=3D"cid:image001.gif@01C158C5.47BB1890" =lang=3DEN-USlink=3Dblue vlink=3Dpurple =style=3D'tab-interval:36.0pt;margin-left:18.75pt;margin-top:18.75pt'><img src=3D"cid:image001.gif@01C158C5.47BB1890"v:src=3D"cid:image001.gif@01C158C5.47BB1890" v:shapes=3D"_x0000_Mail" =width=3D0height=3D0 class=3Dshape style=3D'display:none;width:0;height:0'><div class=3DSection1><p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DVerdana><spanstyle=3D'font-size:10.0pt;font-family:Verdana;color:windowtext'>Hi,<o:p><=/o:p></span></font></p><p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DVerdana><spanstyle=3D'font-size:10.0pt;font-family:Verdana;color:windowtext'>Does =anybody haveany idea how to pick up stylesheet settings from the containing page =within aweb control?<o:p></o:p></span></font></p><p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DVerdana><spanstyle=3D'font-size:10.0pt;font-family:Verdana;color:windowtext'>I am =attemptingcreate a new control for use on asp.net pages, but don’t know how =to dynamicallychange the appearance of the UI by getting stylesheet info. Note that =the stylesheetname and location will be unknown to the control as it could be placed =on anypage, so I can’t hardcode this.<o:p></o:p></span></font></p><p class=3DMsoNormal><font size=3D2 color=3Dblack face=3DVerdana><spanstyle=3D'font-size:10.0pt;font-family:Verdana;color:windowtext'>Has =anyone got auseful beta 2 control sample in VB? <spanstyle=3D'mso-spacerun:yes'> </span><o:p></o:p></span></font></p><div><p class=3DMsoAutoSig><font size=3D2 face=3DVerdana><span =style=3D'font-size:10.0pt;font-family:Verdana;mso-bidi-font-family:Arial;mso-no-proof:yes'>Regards,=</span></font><spanstyle=3D'mso-no-proof:yes'><o:p></o:p></span></p><p class=3DMsoAutoSig><font size=3D3 face=3D"Times New Roman"><span =style=3D'font-size:12.0pt;mso-no-proof:yes'> <o:p></o:p></span></font></p><p class=3DMsoAutoSig><font size=3D2 face=3DVerdana><span =style=3D'font-size:10.0pt;font-family:Verdana;mso-bidi-font-family:Arial;mso-no-proof:yes'>Raj =Sharma<o:p></o:p></span></font></p><p class=3DMsoAutoSig><font size=3D2 face=3DVerdana><span =style=3D'font-size:10.0pt;font-family:Verdana;mso-bidi-font-family:Arial;mso-no-proof:yes'><o:p>&nb=sp;</o:p></span></font></p></div><p><font size=3D2 color=3Dblack face=3DArial><span =style=3D'font-size:10.0pt;font-family:Arial;color:black'> <o:p></o:p></span></font></p></div></body></html>------=_NextPart_001_0010_01C158C5.665BAC10--------=_NextPart_000_000F_01C158C5.665BAC10Content-Type: image/gif;    name="image001.gif"Content-Transfer-Encoding: base64Content-ID: <image001.gif@01C158C5.47BB1890>R0lGODlhLQAtAID/AP////f39ywAAAAALQAtAEACcAxup8vtvxKQsFon6d02898pGkgiYoCm6sq27iqWcmzOsmeXeA7uPJd5CYdD2g9oPF58ygqz+XhCG9JpJGmlYrPXGlfr/Yo/VW45e7amp2tou/lWxo/zX513z+Vt+1n/tiX2pxP4NUhy2FM4xtjIUQAAOw==------=_NextPart_000_000F_01C158C5.665BAC10--
Reply to this message...
 
    
Paul D. Murphy
I'm not quite sure what you are asking. The style sheet is applied to
the control at run time by setting the CssClass property on the control
at design time. If you are deriving from Control or HtmlControl you will
not pick up this property directly. In the case of those base controls
you will need to 1:) add the style property to the control, 2:) at
render time inject the class attribute and value into the opening tag,
3:) and render the response.

Some code (excuse my Vb, I haven't written it in over a year now.)

Public Property CssClass
    Get
=09
    Return Me.cssClass

    End Get
    Set

    Me.cssClass =3D value

    End Set

End Property

Protected Sub Overrides Render(writer as HtmlTextWriter)

    Base.Attributes.Add("Class", Me.cssClass)
    Base.Render(writer)

End Sub

However the easiest way to accomplish the task is to inherit from
WebControl (or any control that derives from WebControl) and set the
CssClass property on that object to a style class name.

Paul

-----Original Message-----
From: Raj Sharma [mailto:Click here to reveal e-mail address]=20
Sent: Friday, October 19, 2001 12:42 PM
To: aspngcontrolsvb
Subject: [aspngcontrolsvb] Stylesheet settings within a custom web
control

-- Copied from [aspngvb] to [aspngcontrolsvb] by Sheik Yerbouti --

This is a multi-part message in MIME format.

------=3D_NextPart_000_000F_01C158C5.665BAC10
Content-Type: multipart/alternative;
    boundary=3D"----=3D_NextPart_001_0010_01C158C5.665BAC10"

------=3D_NextPart_001_0010_01C158C5.665BAC10
Content-Type: text/plain;
    charset=3D"us-ascii"
Content-Transfer-Encoding: 7bit

=20
Hi,
Does anybody have any idea how to pick up stylesheet settings from the
containing page within a web control?
I am attempting create a new control for use on asp.net pages, but don't
know how to dynamically change the appearance of the UI by getting
stylesheet info. Note that the stylesheet name and location will be
unknown to the control as it could be placed on any page, so I can't
hardcode this.
Has anyone got a useful beta 2 control sample in VB? =20
Regards,
=20
Raj Sharma
=20
=20

------=3D_NextPart_001_0010_01C158C5.665BAC10
Content-Type: text/html;
    charset=3D"us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D3D"urn:schemas-microsoft-com:vml" =3D
xmlns:o=3D3D"urn:schemas-microsoft-com:office:office" =3D
xmlns:w=3D3D"urn:schemas-microsoft-com:office:word" =3D
xmlns=3D3D"http://www.w3.org/TR/REC-html40";>

<head>
<META HTTP-EQUIV=3D3D"Content-Type" CONTENT=3D3D"text/html; =3D
charset=3D3Dus-ascii">

<meta name=3D3DProgId content=3D3DWord.Document>
<meta name=3D3DGenerator content=3D3D"Microsoft Word 10">
<meta name=3D3DOriginator content=3D3D"Microsoft Word 10">
<link rel=3D3DFile-List href=3D3D"cid:filelist.xml@01C158C5.47BB1890">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:EnvelopeVis/>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
    {font-family:Helvetica;
    panose-1:2 11 6 4 2 2 2 2 2 4;
    mso-font-charset:0;
    mso-generic-font-family:swiss;
    mso-font-pitch:variable;
    mso-font-signature:536902279 -2147483648 8 0 511 0;}
@font-face
    {font-family:Verdana;
    panose-1:2 11 6 4 3 5 4 4 2 4;
    mso-font-charset:0;
    mso-generic-font-family:swiss;
    mso-font-pitch:variable;
    mso-font-signature:536871559 0 0 0 415 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
    {mso-style-parent:"";
    margin-top:0cm;
    margin-right:0cm;
    mso-margin-bottom-alt:auto;
    margin-left:0cm;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:Helvetica;
    mso-fareast-font-family:"Times New Roman";
    color:#FFFFCC;
    mso-believe-normal-left:yes;}
a:link, span.MsoHyperlink
    {color:blue;
    text-decoration:underline;
    text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
    {color:purple;
    text-decoration:underline;
    text-underline:single;}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
    {margin:0cm;
    margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:12.0pt;
    font-family:"Times New Roman";
    mso-fareast-font-family:"Times New Roman";
    color:windowtext;}
p
    {mso-margin-top-alt:auto;
    margin-right:0cm;
    mso-margin-bottom-alt:auto;
    margin-left:0cm;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:Helvetica;
    mso-fareast-font-family:"Times New Roman";
    color:#FFFFCC;}
span.EmailStyle17
    {mso-style-type:personal-compose;
    mso-style-noshow:yes;
    mso-ansi-font-size:10.0pt;
    mso-bidi-font-size:10.0pt;
    font-family:Verdana;
    mso-ascii-font-family:Verdana;
    mso-hansi-font-family:Verdana;
    color:windowtext;
    mso-text-animation:none;
    font-weight:normal;
    font-style:normal;
    text-decoration:none;
    text-underline:none;
    text-decoration:none;
    text-line-through:none;}
span.SpellE
    {mso-style-name:"";
    mso-spl-e:yes;}
@page Section1
    {size:612.0pt 792.0pt;
    margin:72.0pt 90.0pt 72.0pt 90.0pt;
    mso-header-margin:35.4pt;
    mso-footer-margin:35.4pt;
    mso-paper-source:0;}
div.Section1
    {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */=3D20
table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman";}
</style>
<![endif]--><![if mso 9]>
<style>
p.MsoNormal
    {margin-left:18.75pt;}
</style>
<![endif]><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D3D"edit" spidmax=3D3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D3D"edit">
<o:idmap v:ext=3D3D"edit" data=3D3D"1" />
</o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=3D3Dwhite =
background=3D3D"cid:image001.gif@01C158C5.47BB1890"
=3D
lang=3D3DEN-US
link=3D3Dblue vlink=3D3Dpurple =3D
style=3D3D'tab-interval:36.0pt;margin-left:18.75pt;
margin-top:18.75pt'>
<img src=3D3D"cid:image001.gif@01C158C5.47BB1890"
v:src=3D3D"cid:image001.gif@01C158C5.47BB1890" =
v:shapes=3D3D"_x0000_Mail" =3D
width=3D3D0
height=3D3D0 class=3D3Dshape style=3D3D'display:none;width:0;height:0'>

<div class=3D3DSection1>

<p class=3D3DMsoNormal><font size=3D3D2 color=3D3Dblack =
face=3D3DVerdana><span
style=3D3D'font-size:10.0pt;font-family:Verdana;color:windowtext'>Hi,<o:p=
>
<=3D
/o:p></span></font></p>

<p class=3D3DMsoNormal><font size=3D3D2 color=3D3Dblack =
face=3D3DVerdana><span
style=3D3D'font-size:10.0pt;font-family:Verdana;color:windowtext'>Does =
=3D
anybody have
any idea how to pick up stylesheet settings from the containing page =3D
within a
web control?<o:p></o:p></span></font></p>

<p class=3D3DMsoNormal><font size=3D3D2 color=3D3Dblack =
face=3D3DVerdana><span
style=3D3D'font-size:10.0pt;font-family:Verdana;color:windowtext'>I am =
=3D
attempting
create a new control for use on asp.net pages, but don’t know how
=3D
to dynamically
change the appearance of the UI by getting stylesheet info. Note that =
=3D
the stylesheet
name and location will be unknown to the control as it could be placed =
=3D
on any
page, so I can’t hardcode this.<o:p></o:p></span></font></p>

<p class=3D3DMsoNormal><font size=3D3D2 color=3D3Dblack =
face=3D3DVerdana><span
style=3D3D'font-size:10.0pt;font-family:Verdana;color:windowtext'>Has =
=3D
anyone got a
useful beta 2 control sample in VB? <span
style=3D3D'mso-spacerun:yes'> </span><o:p></o:p></span></font></p>

<div>

<p class=3D3DMsoAutoSig><font size=3D3D2 face=3D3DVerdana><span =3D
style=3D3D'font-size:10.0pt;
font-family:Verdana;mso-bidi-font-family:Arial;mso-no-proof:yes'>Regards
,=3D
</span></font><span
style=3D3D'mso-no-proof:yes'><o:p></o:p></span></p>

<p class=3D3DMsoAutoSig><font size=3D3D3 face=3D3D"Times New =
Roman"><span =3D
style=3D3D'font-size:
12.0pt;mso-no-proof:yes'> <o:p></o:p></span></font></p>

<p class=3D3DMsoAutoSig><font size=3D3D2 face=3D3DVerdana><span =3D
style=3D3D'font-size:10.0pt;
font-family:Verdana;mso-bidi-font-family:Arial;mso-no-proof:yes'>Raj =3D
Sharma<o:p></o:p></span></font></p>

<p class=3D3DMsoAutoSig><font size=3D3D2 face=3D3DVerdana><span =3D
style=3D3D'font-size:10.0pt;
font-family:Verdana;mso-bidi-font-family:Arial;mso-no-proof:yes'><o:p>&n
b=3D
sp;</o:p></span></font></p>

</div>

<p><font size=3D3D2 color=3D3Dblack face=3D3DArial><span =3D
style=3D3D'font-size:10.0pt;
font-family:Arial;color:black'> <o:p></o:p></span></font></p>

</div>

| [aspngcontrolsvb] member Click here to reveal e-mail address =3D YOUR ID<BR>
| http://www.asplists.com/asplists/aspngcontrolsvb.asp =3D JOIN/QUIT<BR>
| http://www.asplists.com/search =3D SEARCH Archives<BR>

</BODY>

</html>

------=3D_NextPart_001_0010_01C158C5.665BAC10--

------=3D_NextPart_000_000F_01C158C5.665BAC10
Content-Type: image/gif;
    name=3D"image001.gif"
Content-Transfer-Encoding: base64
Content-ID: <image001.gif@01C158C5.47BB1890>

R0lGODlhLQAtAID/AP////f39ywAAAAALQAtAEACcAxup8vtvxKQsFon6d02898pGkgiYoCm
6sq2
7iqWcmzOsmeXeA7uPJd5CYdD2g9oPF58ygqz+XhCG9JpJGmlYrPXGlfr/Yo/VW45e7amp2to
u/lW
xo/zX513z+Vt+1n/tiX2pxP4NUhy2FM4xtjIUQAAOw=3D=3D

------=3D_NextPart_000_000F_01C158C5.665BAC10--

Reply to this message...
 
 
System.Web.UI.HtmlControls.HtmlControl
System.Web.UI.HtmlTextWriter
System.Web.UI.WebControls.WebControl




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification