I keep getting an error when placing a usercontrol on a page. Options
tjementum
Posted: Monday, December 10, 2007 2:02:00 AM
Rank: Enthusiast

Joined: 9/16/2007
Posts: 29
Hi

I'm trying to create my first Ascx usercontrol in Umbraco.

But when I try to view the page I get the followig error:

Control 'Test_1_btnSubmit' of type 'Button' must be placed inside a form tag with runat=server.

My template looks like this:

Code:

<?ASPNET_FORM>
<?UMBRACO_MACRO macroAlias="TestUserControl" ></?UMBRACO_MACRO>
</?ASPNET_FORM>


I tried to minimize my ascx to isolate the problem, and I get the error even if it only looks like this:

Code:

<%@ Control Language="VB" ClassName="Test" %>
<script runat="server">
    Protected Sub SubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        'No code yet       
    End Sub
</script>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="SubmitButton_Click"  />


Any sugestions on how to get this to work?

: Thomas
kalpa
Posted: Monday, December 10, 2007 8:48:46 AM

Rank: Fanatic

Joined: 7/19/2006
Posts: 492
Location: Göteborg, Sweden
What does the rendered html page look like?

// ; ) Kalle

" - Yeah I'd like to share your point of view, as long as it's my view too... (http://www.d-a-d.dk/lyrics/pointofview)
tjementum
Posted: Monday, December 10, 2007 10:03:40 AM
Rank: Enthusiast

Joined: 9/16/2007
Posts: 29
The HTML?

I get the yellow ASP.NET error, so I don't rendered HTML.

But I get the error with the following Umbraco Template, if that is what you mean.

Code:

<html>
<head>
    <title>test of user control</title>
<head>
<body>
    <?ASPNET_FORM> 
        <?UMBRACO_MACRO macroAlias="TestUserControl" ></?UMBRACO_MACRO> 
    </?ASPNET_FORM> 
</body>
</html>


: Thomas
kalpa
Posted: Monday, December 10, 2007 10:25:31 AM

Rank: Fanatic

Joined: 7/19/2006
Posts: 492
Location: Göteborg, Sweden
Of course you are... sorry for that stupid question :blush:

Hmmm, your template looks right to me...

Is this a fresh install or a site that has ran for some days?

Sometimes strange things happens in fresh installs that takes an IIS restart to be solved, besides from that I just don't have a clue about what might be the error here...

Could you provide the full error message?

// ; ) Kalle

" - Yeah I'd like to share your point of view, as long as it's my view too... (http://www.d-a-d.dk/lyrics/pointofview)
vonlinaa
Posted: Monday, December 10, 2007 10:45:43 AM
Rank: Aficionado

Joined: 7/23/2006
Posts: 172
Can you compile and run this in Visual studio.

Have you copied the dll to the bin folder.

Søren Linaa
Level 1 & 2 Certified Professional
kalpa
Posted: Monday, December 10, 2007 10:56:35 AM

Rank: Fanatic

Joined: 7/19/2006
Posts: 492
Location: Göteborg, Sweden
A thought:

Is it possible that the user control must use separation with one interface file and one code-behind file to be able to work? I've never tried a user control with inline code myself therefore I can't verify that it will/should work like in the example you provided above...

// ; ) Kalle

" - Yeah I'd like to share your point of view, as long as it's my view too... (http://www.d-a-d.dk/lyrics/pointofview)
tjementum
Posted: Monday, December 10, 2007 12:21:30 PM
Rank: Enthusiast

Joined: 9/16/2007
Posts: 29
Hi Søren

Well... there is no dll. I only deployed the ascx file. All the code is inline.

Am I missing something?

Thanks for helping.

: Thomas
tjementum
Posted: Monday, December 10, 2007 12:23:55 PM
Rank: Enthusiast

Joined: 9/16/2007
Posts: 29
Hi Kalle

Inline vs. code behind should be the same. The ascx file I used is from a sample I found.

I'll try to move it in the code behind tonight.

: Thomas
Simm
Posted: Monday, December 10, 2007 3:07:42 PM

Rank: Fanatic

Joined: 7/22/2006
Posts: 255
Location: Randers, Denmark
Try adding ?umbDebugShowTrace=true to your URL, it should give you a more detailed error description

Best Regards
Simon

Simm.dk - My base on the web - proud Umbracian since 2.0 Beta
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.