We've never experienced this before with DNN but sites which have been running for a long time is throwing itself into Quirks mode because the FallBack Skin Doctype has changed to HTML4 (Legacy).
The only thing I am doing differently now is developing directly onto the ASCX file rather than parsing the skin like I have done in the past. I am not going anywhere near the Host Settings during this process.
Any ideas please?
Thanks
If the skin doesn't specify the DocType then DNN looks at the Host Setting for it. So, you can either change it in the host setting (preferred) or specify it in the skin. Using ASCX for defining the skin rather than HTML shouldn't make any difference.
To specify the doctype for the skin, you have two options:
1.) Create a file named, "Your Skin Name".doctype.xml. e.g. myskin.doctype.xml
In the file, put the following:
<SkinDocType>
<![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">]]>
</SkinDocType>
2.) Add the following at the top of your skin
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim skinDocType as Control = Me.Page.FindControl("skinDocType")
If Not skinDocType is Nothing
CType(skinDocType, System.Web.UI.WebControls.Literal).Text="<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">"
End If
End Sub
</script>
Related
Im using WPF and VB.net and in order to use a picture (source) for an image you need the file to be in the folder of the application, so the source of stack.png would be stack.png.
But I want to use C:/APictureLocation/stack.png. I think Releative file name maybe? I honestly do not know how to ask a question without explaining. Sorry.
So I can do:
image.source = "C:\APictureLocation\stack.png"
instead of
image.source = "stack.png"
Thanks for you help!
Do not vote down without giving me pointers. Doesn't help the community.
My answer!
Private Sub BrowseButton_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
Dim dialog As New OpenFileDialog()
dialog.InitialDirectory = "C:\"
dialog.ShowDialog()
picbox.Source = New System.Windows.Media.Imaging.BitmapImage(New Uri(dialog.FileName, UriKind.Absolute))
End Sub
I believe I have the solution to your problem (or what I think your asking)...
Let's say your image source folder is 'C:\Images\ProgramImages'
(notice how I have used a '\' not a '/' in my path...)
Firstly, create a new form called 'ImageBrowser'. Then, add a ListBox control and name it 'ImageBrowserLB'. After this, double click on the ImageBrowser form so it takes you to the code editor. In the auto-generated sub, type the following:
For Each F As File In System.IO.Directory.GetFiles("C:\Images\ProgramImages\")
If Path.Extension(F) = ".png" Then
ImageBrowserLB.Items.Add(Path.GetFileName(F))
End If
Next
When that form loads, it will add all the files with a PNG extension in the directory I specified. I'm sure you can take this code and manipulate it to do what you would like (which isn't very clear in your question!).
Hope this helped,
Rodit
I have a problem in showing the colordialog when the form is closed.Can we save the custom color selection in the colordialog in VB.NET?
You can get and set the custom colors with the CustomColors property. This is an array of int, where the color format is 00BBGGRR. B is blue, G is green and R is red. You can convert a .Net Color to this format:
Color myColor = Color.Green;
int ColorAsBGR = (((myColor.B << 16) | (myColor.G << 8)) | myColor.R);
dlgColor.CustomColors = new int[] { ColorAsBGR };
or without using .Net colors:
// Get the colors
int[] customColors = dlgColor.CustomColors;
// Set the custom colors
dlgColor.CustomColors = customColors;
You would have to store and retrieve each custom color in an array of int and set the CustomColors property with it.
Since this question is tagged VB.NET 2010 I'll provide a compatible VB.NET answer.
Custom Colors
If the user adds custom colors while working with a ColorDialog, you can access these colors using the CustomColors property. It returns their colors as an Integer().
Using My.Settings
The most convenient place to store these custom colors might be in My.Settings, it gives you an easy place to store settings on a per user basis, if that's what you are looking for.
If you were to attempt to add an Integer() typed setting using the GUI, you'll find that it won't work, Visual Studio doesn't support that.
Luckily, you can still make this work by manually editing the Settings.settings file.
(Thanks to Jen-Ari for this related useful answer.)
To start out, using the GUI in "My Project", add a String typed setting named CustomColors, we'll change the type later.
At the top of Solution Explorer, click "Show All Files", expand "My Project".
You should see a Settings.settings file, right click on that, and select "Open With", select XML (Text) Editor.
The contents of the file will look like this:
Settings.settings
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
<Profiles />
<Settings>
<Setting Name="CustomColors" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
Change Type="System.String" to Type="System.Int32[]", so you have this:
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
<Profiles />
<Settings>
<Setting Name="CustomColors" Type="System.Int32[]" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
Form1.vb:
Here's some sample code showing how you could use this technique:
Public Class Form1
Private Sub btnChooseColor_Click(sender As Object, e As EventArgs) Handles btnChooseColor.Click
'I'm assuming that dlgColorDialog has been placed using the Forms designer.
dlgColorDialog.ShowDialog()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Load the custom colors from My.Settings into the dialog when the form loads.
dlgColorDialog.CustomColors = My.Settings.CustomColors
End Sub
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
'Save the custom colors when the form closes.
My.Settings.CustomColors = dlgColorDialog.CustomColors
My.Settings.Save()
End Sub
End Class
Is there any way to add a custom class to the outer div that contains the "DnnModule" class that is created when a module is placed on a page via the container? Currently, if I make a container that is to be floated left with a specific width, there is no way to utilize that layout unless I use javascript to go in to the HTML and add my float properties to the DnnModule level div.
For example, if I'm using a scaffolding system (bootstrap) and want to add several containers of different sizes (span3, span6, span12) when I add a module to the content pane with those containers, the layout is ignored due to the outer div that DNN adds around each module. This is extremely limiting from a CSS layout perspective and it forces the skin developer to create many individually styled skins rather than a couple skins with multiple containers to allow for more flexibility.
Found an answer on the DotNetNuke.com forums:
<script runat="server">
Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
Try
Dim cParent As HtmlGenericControl = CType(Me.Parent, HtmlGenericControl)
cParent.Attributes("class") = cParent.Attributes("class") + " span6"
Catch ex As Exception
End Try
End Sub
</script>
Adding this to the container .ascx file allows me to insert my own specific class to the wrapper div.
Source: http://www.dotnetnuke.com/Resources/Forums/forumid/109/threadid/458919/scope/posts.aspx
C# version:
<script runat="server">
protected void Page_PreRender(object sender, EventArgs e) {
try {
HtmlGenericControl cParent = (HtmlGenericControl) this.Parent;
cParent.Attributes["class"] += " span6";
} catch (Exception ex) {
// do nothing
}
}
</script>
I think that DIV is always added automatically by DNN, and that it always has that DNNModule class, and I don't think there's an extension point for a skin or container to modify it.
Which means I think your best bet is to use jQuery (which, IIRC, is baked into current DNN images), and initial it in the skin .ascx file.
Something like (not tested):
$(".DNNModule").addClass("MyMagicClass");
This is an old question, but today I have a similar problem and at the end I use this other solution triying to add a css class to the body at code behind:
<script runat="server">
protected void Page_PreRender(object sender, EventArgs e)
{
try
{
HtmlGenericControl body = (HtmlGenericControl)Page.FindControl("body");
body.Attributes.Add("class", " fontSize" + Utils.SiteFontSize);
}
catch (Exception)
{
// do nothing
}
}
</script>
I have a Silverlight application in which I display some phone numbers. I want that numbers to be displayed as links and when the user clicks on the links to be redirected to skype. (The same as on html).
This is the equivalent in html (just to understand what i need):
+11 11 111 11 11
In silverlight I tried with:
<HyperlinkButton Content="{Binding}" NavigateUri="{Binding StringFormat=callto:\{0\}}" />
but I get System.InvalidOperationException: Failed to navigate to callto:+11 11 111 11 11.
Does somebody knows a solution for this?
Can you try using Javascript to invoke that sort of anchor? If you're able to do this via Javascript, try using the Eval function to invoke the Javascript from Silverlight:
HtmlPage.Window.Eval();
This may be a little late, but if you still want to keep it in Silverlight code, then this will work:
Public Class MyHyperLink : Inherits HyperlinkButton
Sub New(ByVal uri As String)
MyBase.NavigateUri = New Uri(uri)
End Sub
Public Sub Execute()
Application.Current.Host.Content.IsFullScreen = False
MyBase.TargetName = "_blank"
MyBase.OnClick()
End Sub
End Class
And to call, add the following code::
Dim nav As New MyHyperLink(URL)
nav.Execute()
I am extremely new to dotnetnuke. I don't know which server side language can write in Dotnetnuke skin.ascx page. How to write server side script in skin.ascx file?
just use <% %> same as normal .aspx./ascx page, for example:
<%
DotNetNuke.Framework.jQuery.RequestRegistration()
%>
just use the syntax of vb or c# whatever you are using
Or alternatively use this. Also works with VB or C#
<script runat="server">
Protected Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'do something'
End Sub
</script>
You can also create a skin object which is similar to a user control see the link below for a simple example that adds hello to the login users name
http://www.datasprings.com/Resources/ArticlesInformation/DevelopingandImplementingDNNSkinObjects.aspx