This is a migrated thread and some comments may be shown as answers.

custom namespace/hyperlink

1 Answer 97 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Debbie Bick
Top achievements
Rank 1
Debbie Bick asked on 02 Dec 2010, 07:44 PM

I have a website project and want to put a hyperlink on the web page. To do this, I created a custom namespace in Default.aspx.cs. I got errors when building the solution. Is

the namespace code in the wrong place ? or do I need to create an assembly for it to fix the errors ? What am I missing ?
Here is the namespace, other details and errors:

In Default.aspx page I put 
<%@ Register TagPrefix="study1wc" Namespace="study1.webcontrols" %>
<study1wc:popupWindow NavigateUrl="http://www.google.com" runat="server" ID="test">testing</study1wc:popupWindow>




In Default.aspx.cs page I put
namespace
study1.webcontrols { public class popupWindow : HyperLink {etc... }

 

protected override void Render(HtmlTextWriter writer)

 

{

 

HyperLink link = this;

 

writer.Write(

"&lt;a");

 

 

 

if (!string.IsNullOrEmpty(link.NavigateUrl))

 

writer.WriteAttribute(

"href", "#");

 

 

if (!string.IsNullOrEmpty(link.CssClass))

 

writer.WriteAttribute(

"class", link.CssClass);

 

 

if (_intWindowHeight <= 0 || _intWindowWidth <= 0)

 

{writer.WriteAttribute(

"onclick", "window.open('" + link.NavigateUrl + "');return false;");}

 

 

else

 

{writer.WriteAttribute(

"onclick", "window.open('" + link.NavigateUrl + "','"+ _strPopupTitle +"','width="+ _intWindowWidth +",height="+ _intWindowWidth +"');return false;");}

 

 

foreach (string key in link.Attributes.Keys)

 

{writer.WriteAttribute(key, link.Attributes[key]);}

writer.Write(

"&gt;");

 

RenderContents(writer);

 

writer.Write(

"&lt;/a>");

 

 

}

 

protected override void RenderContents(HtmlTextWriter output)

 

{output.Write(Text);}

}

}
[Note: there is a RadGrid and RadComboBoxes defined after the custom namespace]




Errors when I Build Solution:
Default.aspx - Warning  Element 'popupWindow' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing. 
Default.aspx - Error   Unknown server tag 'study1:popupWindow'. 

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 06 Dec 2010, 03:59 PM
Hello Debbie,

I tried to replicate the issue which you described, but to no avail.
Attached to this message, you will find the code which I used for testing.

Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.

Best wishes,
Mira
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
General Discussions
Asked by
Debbie Bick
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or