PagodNaUtak
asked on
Creating server control
Hi! is this the correct way of doing thing?
Creating a specific css class for a specific control, Is the correct implementation? or do you have any other suggestion...
Your comment is greatly appreciated.
Creating a specific css class for a specific control, Is the correct implementation? or do you have any other suggestion...
Your comment is greatly appreciated.
Option Strict On
Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
<Serializable()> _
Public Class SmartItems
Inherits WebControl
Private _CSSLocation As String = ""
<Browsable(True)> _
Public Property CSSLocation() As String
Get
Return _CSSLocation
End Get
Set(ByVal value As String)
_CSSLocation = value
End Set
End Property
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
MyBase.Render(writer)
'Creating a specific css class for a specific control, Is the
'correct implementation?
writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/css")
writer.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet")
writer.AddAttribute(HtmlTextWriterAttribute.Href, _CSSLocation)
writer.RenderBeginTag(HtmlTextWriterTag.Link)
writer.AddAttribute(HtmlTextWriterAttribute.Class, "MainContainer")
writer.RenderBeginTag(HtmlTextWriterTag.Div)
writer.RenderBeginTag(HtmlTextWriterTag.Span)
writer.RenderEndTag()
writer.RenderEndTag()
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Is this the correct approach? how do I implement the CSS is it inside the control or in the page?