Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Embedding CSS in Custom Server Control AssemblyEmbedding CSS in Custom Server Control Assembly
Previous
 
Next
New Post
10/10/2007 12:13 AM
 

I'm putting the finishing touches on a complex custom server control (image upload/editor that includes cropping, rotation, brightness/saturation adjustments, etc.) and would now like to embed the css style sheet that is used when creating the many absolutely positioned divs created for the cropping operation into the control's assembly.  I have done this successfully with the various icon images and javascript but am at a loss as to how to do this for the CSS style sheet in for an install in DNN. For testing purposes, I'm simply including the style definitions in the test module's module.css file.

While there is no problem embedding the css style sheet, the problem is how can I inject the necessary WebResource.axd linkage into the <style . . .> tags of a DNN page on which the control will appear. For a simple ASP.NET 2.0 page this is not difficult - but has anyone tried something like this within DNN?


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
10/10/2007 8:51 PM
 

After getting back to this tonight, I can answer my own question - it's actually easy to do in DNN because Default.aspx includes a placeholder control for style sheet linkage injection.  In the Init event handler of the server control:

Private Sub ImageEditor_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
     Dim CSSLinkID As String = "WESNetImageEditor"
     Dim CSSLink As String = Page.ClientScript.GetWebResourceUrl(Me.GetType(), "WESNetImageEditor.css")
     If Not String.IsNullOrEmpty(CSSLink) Then
          Dim phCSS As Control = Page.FindControl("CSS")
          If Not phCSS Is Nothing Then
               If Page.Header.FindControl(CSSLinkID) Is Nothing Then
                    Dim styleLink As New HtmlControls.HtmlLink
                    With styleLink
                      .ID = CSSLinkID
                      .Attributes("rel") = "stylesheet"
                      .Attributes("type") = "text/css"
                      .Href = CSSLink
                    End With
                    phCSS.Controls.AddAt(0, styleLink)
               End If
           End If
     End If
End Sub

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Embedding CSS in Custom Server Control AssemblyEmbedding CSS in Custom Server Control Assembly


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out