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
Related
I have linked one of my VB.net forms to an MS Access database table, However, when I save the data entered from the VB form into the data set, the data will show in the data set but it will not appear in my database table. Is there anyway I can get the data that I have stored in the data set to appear in the actual database.
I have bound the form fields correctly to the database table and I have added the tables to the form via a data grid.
![Form & Data grid][1]
Can anyone tell me why it won't save to my database? or does anyone have an alternative method for binding forms to a database.
*Note - My database also has a password on it (don't know if that effects it)
*Note - I'm new to this forum so i cant post an image...
*Note - Let me know if you need to see more code
Form loading code
Public Class CD_FORM
Private Sub CD_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'CDKingsDatabaseDataSet.CD' table. You can move, or remove it, as needed.
Me.CDTableAdapter.Fill(Me.CDKingsDatabaseDataSet.CD)
End Sub
ADD Button code
Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles add.Click
CDBindingSource.AddNew()
End Sub
SAVE Button code
Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles sav.Click
CDBindingSource.EndEdit()
CDTableAdapter.Update(CDKingsDatabaseDataSet.CD)
End Sub
Ah Ok I've found the solution thanks to a comment by jmcilhinney on the "VB.NET - .accdb database not saving changes" question made a while back.
The changes to my database have been made but the database I was looking at was in the wrong location.
The database which stored the changes was in my bin/Debug folder.
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
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>
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 doing a MVC 2 vb project for a company, and the following codes are used to retrieve database tables thru model.edmx. I have mutiple tabs which I've implemented separate partial views to contain the data.
View page
<% Using Html.BeginForm("BkgEntry", "BookingController")%>
<input button type="submit" />
.
.
.
<div> <% Html.RenderPartial("~/Views/Booking/pax.ascx", ViewData("pax"))%></div>
<div> <% Html.RenderPartial("~/Views/Booking/itinerary.ascx", ViewData("itinerary"))%></div>
<% End Using %>
Controller page
<HttpPost()>
Function BkgEntry(ByVal collection As FormCollection, ByVal bill As Billing, ByVal pax As Pax, ByVal Itinerary As Itinerary, ByVal id As Integer) As ActionResult
.
.
.
_db.ApplyCurrentValues(billing.EntityKey.EntitySetName, bill)
_db.ApplyCurrentValues(pa.EntityKey.EntitySetName, pax)
_db.ApplyCurrentValues(itin.EntityKey.EntitySetName, Itinerary)
_db.SaveChanges()
Return RedirectToAction("BkgEntry")
End Function
So here's the problem, when I click on "submit" button, it pops out an error refering to '_db.ApplyCurrentValues(itin.EntityKey.EntitySetName, Itinerary)
' that "itinerary" is null there it cannot be updated.
This is because "Itinerary" wasnt passed into the BkgEntry post function. Unlike Pax and Bill was able to. I have tried several methods and I derived at wondering if it is because of mutiple partial forms coliding with <%Html Begin form%>that cause the error at the view, if so, how can I solve it?
Solved. thanks anyway, it was just silly of me to include another <% HtmlBegin Form%> and <% End Using %> in the separate partial views as well, i guess the <% End Using %> in the first partial shuts down my whole <% HtmlBeign Form %> operation at the start.
Derrick