(This should be easy) Problem with usercontrol's codebehind Options
leonelpc
Posted: Friday, August 15, 2008 1:06:00 PM
Rank: Newbie

Joined: 8/15/2008
Posts: 7
Location: India
Hi,

I'm new to umbraco, experienced in .NET though, so please be patient. I'm created a very simple usercontrol in a web application. This control has a code-behind file. Now after compiling the project in vs2005 I have added the output assembly(.dll) and copied to the /bin directory of my umbraco installation, then I copied both the usercontrol file(.ascx) and the code-behind file (.ascx.cs) to the /usercontrols directory of my umbraco installation. I created a new macro to use my usercontrol and then referenced this macro in a template.
Everything seems to be fine till, moreover, the web page is display as expected but the code-behind doesnt seem to be working....this usercontrol has a textbox, a label and button, when the button is clicked then the label displays whatever text is inside the textbox. The usercontrol displays in the web page perfectly but no action seems to be happening. As if the conde-behind wasnt working.
Can anybody help with please? I have no idea what's going on.

Thanks,

Leo.
rsoeteman
Posted: Friday, August 15, 2008 1:14:29 PM

Rank: Aficionado

Joined: 4/3/2008
Posts: 103
Location: The Netherlands
Hi Leo,

Did you put the <?ASPNET_FORM> Arround your macro tag? I think not and therefore the postback mechanism is not working

Below the example from the Creative website wizard contact form (wich is a usercontrol)

<?ASPNET_FORM>
<?UMBRACO_MACRO macroAlias="UsercontrolContactForm" EmailTo="[#EmailTo]" EmailSubject="[#EmailSubject]" EmailBody="[#EmailMessage]" EmailReplyFrom="[#EmailReplyFrom]" EmailReplySubject="[#EmailReplySubject]" EmailReplyBody="[#EmailReplyMessage]" MailServer="[#MailServer]" ServerUser="[#ServerUser]" ServerPass="[#ServerPass]" Redirect="[#Redirect]"></?UMBRACO_MACRO>
</?ASPNET_FORM>

Regards,

Richard

ASP.NET and Umbraco development - Soeteman Software
leonelpc
Posted: Friday, August 15, 2008 1:23:38 PM
Rank: Newbie

Joined: 8/15/2008
Posts: 7
Location: India
Yes, I did surround it with aspnet form tag. Otherwise it would issue a compilation error. Here is my template. It does issues the postback but the code-behind doesnt work :(. This is my template.

<?ASPNET_FORM>
<?UMBRACO_GETITEM field="bodyText" />
<?UMBRACO_GETITEM field="color" />
<span>Just a text entered from a template</span>
<?UMBRACO_MACRO macroAlias="LeoUMBMacro" ></?UMBRACO_MACRO>
<br/><br/>
<?UMBRACO_MACRO macroAlias="GreeterMac" ></?UMBRACO_MACRO>

</?ASPNET_FORM>

Any ideas ?

Thanks,

Leo.
rsoeteman
Posted: Friday, August 15, 2008 1:27:05 PM

Rank: Aficionado

Joined: 4/3/2008
Posts: 103
Location: The Netherlands
Can you attach a debugger and see what happens during the postback?

Here is a link that demonstrates how to attach the debugger

Regards,

Richard

ASP.NET and Umbraco development - Soeteman Software
leonelpc
Posted: Friday, August 15, 2008 1:37:04 PM
Rank: Newbie

Joined: 8/15/2008
Posts: 7
Location: India
Thanks, Richard:

I'll work around this tomorrow and let you know the outcome. I've been working for nearly 9 hours now. So tomorrow, I'll see what I can do with it.

Cheers,

Leo.
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.