473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

custom control wont work -

kal
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
Jun 5 '07 #1
2 1425
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" <ak*@noplace.comwrote in message
news:wx***************@newsfe1-win.ntli.net...
>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


Jun 6 '07 #2
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
Jun 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Curtis Justus | last post by:
Hi, My goal is to have a series of thumbnail images on a control/panel and to drag/drop those items onto another control (i.e. a treeview). I am able to drag one item and need to somehow select...
2
by: Showjumper | last post by:
I still cant get an icon to display for my custom server control in the toolbox. I create a bmp that is the same name as the class of the control. I set it to embedded resource and then build but...
0
by: Lenny | last post by:
Hello, I have an html table template which I want to turn into ASP.NET custom control. I want to utilize the best features of OOP. I want to be able to create columns headings dynamically, add...
1
by: Stephen Adam | last post by:
Hi there, I have written a custom validation control which checks to see of an input field is not empty and contains only numeric data. I was using a regular expression validation control but...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
1
by: WebMatrix | last post by:
Hi, I started a new web application which so far has several grdiviews displaying data. I find myself reimplementing the same logic (copy/pasting really) in grid's event ItemDataBound and...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
1
by: Fendi Baba | last post by:
I wrote a simple validation routine. I am trying to trigger validation on group of fields if an option on another radio button is selected. Sub ValidateAdd_ServerValidate(ByVal objSource As...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.