Microsoft Content Management Server - strange behaviour in UserControl

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > October 2004 > strange behaviour in UserControl





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author strange behaviour in UserControl
Charles Bell

2004-10-26, 5:48 pm

Hi Folks,

I've come across some strange behaviour in a UserControl. Basically, I've
added a standard Web user control to a CMS template (it just allows the user
to select info from a database that sits on the same server - kind of
integrating CMS with an external app).

So, I have two repeaters (to list the first letters of the external data)
and two buttons.

Here's some code:

this.rpLetters.ItemCommand += new
System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rpLetters_ItemCommand);


this.rp2Letters.ItemCommand += new
System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rp2Letters_ItemCommand);


this.cmdSubmit.Click +=new EventHandler(cmdSubmit_Click);

this.cmdReset.Click +=new EventHandler(cmdReset_Click);

Now, the first two items - repeater item commands - cause explicit postbacks
via the javascript:__doPostback(...) calls.

But the cmdSubmit and cmdReset don't do anything - clicking the button gives
no response. These commands are in the Page_Load block of my UserControl and
I can step through the code to confirm that they're being executed (the fact
that the repeater itemcommands are working is proof of that).

Any ideas?

The usercontrol is in a CMS aspx template file.


Stefan [MSFT]

2004-10-26, 5:48 pm

Hi Charles,

did you set a break point in the cmdSubmit_Click routine to see if it gets
fired?

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Charles Bell" <charlie@bang.co.uk> wrote in message
news:OvD36G4uEHA.2804@TK2MSFTNGP14.phx.gbl...
> Hi Folks,
>
> I've come across some strange behaviour in a UserControl. Basically, I've
> added a standard Web user control to a CMS template (it just allows the

user
> to select info from a database that sits on the same server - kind of
> integrating CMS with an external app).
>
> So, I have two repeaters (to list the first letters of the external data)
> and two buttons.
>
> Here's some code:
>
> this.rpLetters.ItemCommand += new
>

System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rpLetters_ItemCom
mand);
>
>
> this.rp2Letters.ItemCommand += new
>

System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rp2Letters_ItemCo
mmand);
>
>
> this.cmdSubmit.Click +=new EventHandler(cmdSubmit_Click);
>
> this.cmdReset.Click +=new EventHandler(cmdReset_Click);
>
> Now, the first two items - repeater item commands - cause explicit

postbacks
> via the Java script:__doPostback(...) calls.
>
> But the cmdSubmit and cmdReset don't do anything - clicking the button

gives
> no response. These commands are in the Page_Load block of my UserControl

and
> I can step through the code to confirm that they're being executed (the

fact
> that the repeater itemcommands are working is proof of that).
>
> Any ideas?
>
> The usercontrol is in a CMS aspx template file.
>
>



Charles Bell

2004-10-26, 5:48 pm

Yes - and it doesn't get fired.

It's REALLY strange because I have other UserControls with buttons in them
and they fire alright. I was wondering if there was anything obvious that
I'm missing.

"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
news:OlW4$O4uEHA.944@TK2MSFTNGP11.phx.gbl...
> Hi Charles,
>
> did you set a break point in the cmdSubmit_Click routine to see if it gets
> fired?
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> MCMS FAQ:
> http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
> http://www.gotdotnet.com/community/...t+S
erver

> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "Charles Bell" <charlie@bang.co.uk> wrote in message
> news:OvD36G4uEHA.2804@TK2MSFTNGP14.phx.gbl...
> user
> System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rpLetters_ItemCom
> mand);
> System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rp2Letters_ItemCo
> mmand);
> postbacks
> gives
> and
> fact
>
>



Stefan [MSFT]

2004-10-26, 5:48 pm

Hi Charles,

sounds more like an ASP.NET problem than a MCMS problem. Actually templates
are nothing but special web forms.
You should post this question to an ASP.NET related newsgroup.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Charles Bell" <charlie@bang.co.uk> wrote in message
news:OLmdaf4uEHA.3840@TK2MSFTNGP12.phx.gbl...
> Yes - and it doesn't get fired.
>
> It's REALLY strange because I have other UserControls with buttons in them
> and they fire alright. I was wondering if there was anything obvious that
> I'm missing.
>
> "Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
> news:OlW4$O4uEHA.944@TK2MSFTNGP11.phx.gbl...
gets[vbcol=seagreen]
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm[vbcol=seagreen]
http://www.gotdotnet.com/community/...t+S
erver
[vbcol=seagreen]
I've[vbcol=seagreen]
data)[vbcol=seagreen]
System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rpLetters_ItemCom[vbcol=seagreen]
System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rp2Letters_ItemCo[vbcol=seagreen]
UserControl[vbcol=seagreen]
>
>



Charles Bell

2004-10-26, 5:48 pm

Thanks Stefan - after a bit of digging, I found the problem. It was indeed
an ASP.NET issue - it was caused by a rogue <form> block inside the
UserControl overriding the external <form runat=server> block..

I had this issue once before about a week ago and I posted the solution on
this group.

So, once is forgivable, twice is stupidity. If I write back on this group
with the same problem again, you have my permission to punch me. ;-)


"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
news:OpIflj4uEHA.3152@TK2MSFTNGP14.phx.gbl...
> Hi Charles,
>
> sounds more like an ASP.NET problem than a MCMS problem. Actually
> templates
> are nothing but special web forms.
> You should post this question to an ASP.NET related newsgroup.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> MCMS FAQ:
> http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
> http://www.gotdotnet.com/community/...t+S
erver

> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "Charles Bell" <charlie@bang.co.uk> wrote in message
> news:OLmdaf4uEHA.3840@TK2MSFTNGP12.phx.gbl...
> gets
> http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
> http://www.gotdotnet.com/community/...t+S
erver

> I've
> data)
> System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rpLetters_ItemCom
> System.Web.UI.WebControls.RepeaterCommandEventHandler(this.rp2Letters_ItemCo
> UserControl
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com