Developer forum

Forum » Development » Usercontrols in DW 8.1.1.0

Usercontrols in DW 8.1.1.0

Rob Lohmann
Reply
We've just upgraded a solution from version 8.1.0.0 to 8.1.1.0 and in both version it's not possible to load custom made user controls. I've already seen a topic on the forum regarding this issue (http://developer.dynamicweb-cms.com/forum.aspx?PID=48&ThreadID=29475) but it doesn't provide a resolution.

We're trying to load a user control with a contactform inside using the following code:
<!--@LoadControl(/Usercontrols/INNO_ContactForm.ascx)-->

Unfortunately no output is being rendered. What could be going wrong here? We also tried with the new module to load .ascx controls, but that is also showing us no results.

Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
Hi Rob,

Could this be another issue with Default.aspx or Global.asax? I just tested this out with a new, clean DW instalaltion and it works for me.

Does the User Control run OK by itself? Maybe the control raises an Exception for some reason?

Imar
 
Jop Reuvers
Reply
 Imar,

When we try to view the usercontrol directly (http://solutionname.dev/Usercontrols/INNO_ContactForm.ascx) we´re getting a 404.7 - Not Found error.

Here's the default.aspx for this solution:
Imports System
Imports System.Xml
Imports Dynamicweb
Imports Dynamicweb.Frontend
Partial Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Render all DW Output
        Output.Controls.Add(New PageviewControl())
    End Sub
End Class
And here's the Global.asax:
Imports System.Web.SessionState

Public Class Global_asax
    Inherits System.Web.HttpApplication
    'Dim GlobalAsax As Dynamicweb.Frontend.GlobalAsaxHandler

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
		' Fires when the application is started
        Dynamicweb.Frontend.GlobalAsaxHandler.Application_Start(sender, e)
    End Sub

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
		' Fires when the session is started
        Dynamicweb.Frontend.GlobalAsaxHandler.Session_Start(sender, e)
	End Sub

	Sub Application_OnPreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
        Dynamicweb.Frontend.GlobalAsaxHandler.Application_OnPreRequestHandlerExecute(sender, e)
	End Sub

	Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
		' Fires at the beginning of each request
		'GlobalAsax.Application_BeginRequest(sender, e)
	End Sub

    Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
		' Fires upon attempting to authenticate the use
        Dynamicweb.Frontend.GlobalAsaxHandler.Application_AuthenticateRequest(sender, e)
    End Sub

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
		' Fires when an error occurs
        Dynamicweb.Frontend.GlobalAsaxHandler.Application_Error(sender, e)
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
		' Fires when the session ends
        Dynamicweb.Frontend.GlobalAsaxHandler.Session_End(sender, e)
    End Sub

    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
		' Fires when the application ends
        Dynamicweb.Frontend.GlobalAsaxHandler.Application_End(sender, e)
	End Sub
End Class

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
>> When we try to view the usercontrol directly (http://solutionname.dev/Usercontrols/INNO_ContactForm.ascx) we´re getting a 404.7 - Not Found error.

Yes, that makes sense. This is a standard .NET feature as User Controls cannot be requested directly. What I mean was viewing the control in a regular ASPX page that's not served by Dynamicweb.

Your default and global files look fine to me. Can you post the markup and code behind of the user control as well?

Cheers,

Imar

 


 
Jop Reuvers
Reply
This post has been marked as an answer
We've found the problem, we've made a mistake ourselves in our ascx file. There was a <asp:HiddenField> with a CssClass attribute, sorry for the inconvenience!
Votes for this answer: 0
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
Ah, yes, that would explain it.... ;-)

Cheers,

Imar

 

You must be logged in to post in the forum