PC Review


Reply
Thread Tools Rate Thread

custom control wont work -

 
 
kal
Guest
Posts: n/a
 
      5th Jun 2007
I have registered my custom control in web.config as follows:
<add tagPrefix="PhoenixControls" namespace="PhoenixControls"
assembly="PhoenixControls"/>

I have added a file called phoenixcontrols.cs to App_Code folder and in this
file is this simple code:

namespace PhoenixControls

{

public class EncodeHtml : Control {

protected override void Render(HtmlTextWriter writer) {

LiteralControl lc;

lc = (LiteralControl) Controls[0];

writer.Write("This is a test" + lc.Text);

}}}


Including all the 'using' statements

Now I put this in a default.aspx page

<PhoenixControls:EncodeHtml>pc-control</PhoenixControls:EncodeHtml>

i get an error - EncodeHtml element is not known. the page displays but has
none of the custom control changes.

Help appreciated

Kal


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      6th Jun 2007
Your Control won't compile. It has errors in it. You have inherited Control,
and referenced "Controls[0]" - but there are no Controls in the Control.

You need to get and use some debugging tools and techniques. There are free
ASP.Net tools available from Microsoft. see
http://msdn.microsoft.com/vstudio/express/vwd/

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"kal" <(E-Mail Removed)> wrote in message
news:wxc9i.1639$(E-Mail Removed)...
>I have registered my custom control in web.config as follows:
> <add tagPrefix="PhoenixControls" namespace="PhoenixControls"
> assembly="PhoenixControls"/>
>
> I have added a file called phoenixcontrols.cs to App_Code folder and in
> this file is this simple code:
>
> namespace PhoenixControls
>
> {
>
> public class EncodeHtml : Control {
>
> protected override void Render(HtmlTextWriter writer) {
>
> LiteralControl lc;
>
> lc = (LiteralControl) Controls[0];
>
> writer.Write("This is a test" + lc.Text);
>
> }}}
>
>
> Including all the 'using' statements
>
> Now I put this in a default.aspx page
>
> <PhoenixControls:EncodeHtml>pc-control</PhoenixControls:EncodeHtml>
>
> i get an error - EncodeHtml element is not known. the page displays but
> has none of the custom control changes.
>
> Help appreciated
>
> Kal
>
>



 
Reply With Quote
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
Posts: n/a
 
      7th Jun 2007
Hi Kal,

<pages>
<controls>
<add assembly="__code" namespace="PhoenixControls"
tagPrefix="PhoenixControls"/>
</controls>
</pages>


hope this helps
--
Milosz


"kal" wrote:

> I have registered my custom control in web.config as follows:
> <add tagPrefix="PhoenixControls" namespace="PhoenixControls"
> assembly="PhoenixControls"/>
>
> I have added a file called phoenixcontrols.cs to App_Code folder and in this
> file is this simple code:
>
> namespace PhoenixControls
>
> {
>
> public class EncodeHtml : Control {
>
> protected override void Render(HtmlTextWriter writer) {
>
> LiteralControl lc;
>
> lc = (LiteralControl) Controls[0];
>
> writer.Write("This is a test" + lc.Text);
>
> }}}
>
>
> Including all the 'using' statements
>
> Now I put this in a default.aspx page
>
> <PhoenixControls:EncodeHtml>pc-control</PhoenixControls:EncodeHtml>
>
> i get an error - EncodeHtml element is not known. the page displays but has
> none of the custom control changes.
>
> Help appreciated
>
> Kal
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control + C wont work WREFORD Microsoft Excel Misc 3 25th Aug 2005 04:44 PM
system icon in control panel wont work at all =?Utf-8?B?cnlhbg==?= Windows XP Help 1 28th Mar 2005 01:01 PM
Control Panel Wont Work! =?Utf-8?B?SW1EZVNwRXJBdEU=?= Windows XP General 2 13th Mar 2005 02:13 PM
right click wont work, restore wont work, java wont install =?Utf-8?B?am9obm55bW90aW9u?= Windows XP Help 1 17th Jan 2005 07:51 PM
Control key wont work John De Groot Windows XP General 0 31st Jul 2003 08:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:56 AM.