I made a user control (.ascx/macro) to use in an Umbraco page. The user control has ASP.NET textboxes and submit button.
When I open at the page in my brower, the rendering seems to choke when it gets to the first textbox. Within my Visual Studio project, the user control renders fine within a test.aspx page.
Am I doing something wrong, or are textboxes not allowed for some reason in Umbraco user controls?
Pretty odd, you can basically do anything with a user control as you would in asp.net, so it shouldn't choke on that. Have you tried debugging the user control to check what's happening?
Debugging is as easy as attaching to the w3wp.exe process in vs.net while browsing to the page of your umbraco website that contains the macro/user control
In addition to Dirk's suggestion, please also try without any CSS or Javascript involved in the content/template. And also try running it in other browsers.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:test ID="test1" runat="server" />
</div>
</form>
</body>
</html>
[no code in the code-behind page]
The rendered user control within my Umbraco page only shows the text test3. When I look at "view source" in the browser, there is no button, no second label text. It's like it stops rendering the control once it hits the button (ASP.NET textbox controls give the same problem.)
My VS proejct is called ascxTest. When I upload to the Umbraco server, I put
No textboxes in user controls?
I made a user control (.ascx/macro) to use in an Umbraco page. The user control has ASP.NET textboxes and submit button.
When I open at the page in my brower, the rendering seems to choke when it gets to the first textbox. Within my Visual Studio project, the user control renders fine within a test.aspx page.
Am I doing something wrong, or are textboxes not allowed for some reason in Umbraco user controls?
Pretty odd, you can basically do anything with a user control as you would in asp.net, so it shouldn't choke on that. Have you tried debugging the user control to check what's happening?
Debugging is as easy as attaching to the w3wp.exe process in vs.net while browsing to the page of your umbraco website that contains the macro/user control
Let us know what you find out.
Cheers,
/Dirk
Hi tesuji,
ASP.NET TextBox should works fine in UserControl.
In addition to Dirk's suggestion, please also try without any CSS or Javascript involved in the content/template. And also try running it in other browsers.
Cheers,
Ferry
To attach to the w3wp.exe process, I would need Umbraco running on my local machine, I assume? Right now it's just running at our shared web host.
I'm not doing anything fancy with this - no CSS, Javascript, etc. Just a simple ASP.NET form. It's a weird problem.
VS can do Remote Debugging but it requires some steps to setup, on your end and your host's.
But as stated above it should work fine...can you paste your code? Do you get any errors or is something just not displaying right?
I'm now troubleshooting using a simple test project with a button instead of a textbox.
I don't have a lot of experience with .NET User controls but I've used a few in Umbraco in the past that just contained JavaScript and HTML.
If you want I can put the code at an FTP location and you can download it. Let me know.
Here is my code...
test.ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="test.ascx.cs" Inherits="ascxTest.test" %>
<b>test3</b>
<asp:Button ID="Button1" runat="server" Text="Button" />
<b>testend</b>
[no code in the code-behind page]
My test ASP.NET page in my VS project, with the user control - this test page works fine:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="testpage.aspx.cs" Inherits="ascxTest.testpage" %>
<%@ Register src="test.ascx" tagname="test" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:test ID="test1" runat="server" />
</div>
</form>
</body>
</html>
[no code in the code-behind page]
The rendered user control within my Umbraco page only shows the text test3. When I look at "view source" in the browser, there is no button, no second label text. It's like it stops rendering the control once it hits the button (ASP.NET textbox controls give the same problem.)
My VS proejct is called ascxTest. When I upload to the Umbraco server, I put
test.ascx /usercontrols and
ascxTest.dll in /bin
Are you including the usercontrol via a Macro or directly in the template?
Either way, maybe try enclosing in a form runat=server tag
IE:
<form runat="server">
<umbraco:Macro .....> (or <uc1:test ID="test1" runat="server" /> )
</form>
That worked. I added the form runat=server tag to the user control.
Much thanks.
is working on a reply...