473,407 Members | 2,546 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,407 software developers and data experts.

TagPrefix is not recognized

Hello

I am creating a ASP.net 2.0 webpart for use in an aspx just for
learning purpose.
My webpart code is very simple :

Now when I use this webpart DLL as a reference in website project and
include this line

<%@ Register TagPrefix="custom" Namespace="aspwebpart" %>

The custom keywork is not usable inside the aspx page.
These lines throw the error that FeaturePart is not recognized
<WebPartsTemplate>

<custom:FeaturePart ID="my" Runat="Server" />
</WebPartsTemplate>

Any Ideas??

================================================== =========

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;

namespace aspwebpart
{

public class FeaturePart:WebPart
{
const string str =
"server=10.111.121.24;Trusted_Connection=true;Data base=NorthWind";
const string query = "Select * from products";

public FeaturePart()
{
this.Title = "Feature Part";
}

protected override void RenderContents(HtmlTextWriter writer)
{

DataTable pt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(query, str);
da.Fill(pt);
Random rnd = new Random();
DataRow row = pt.Rows[rnd.Next(pt.Rows.Count)];

writer.Write((string)row["ProductName"]);
writer.Write(string.Format("-{0:c}", row["UnitPrice"]));

base.RenderContents(writer);
}

}
}

Regards

Madhur

Jul 21 '06 #1
3 2917
Madhur,

Check out my post "Error creating control..Server tag error" from earlier in
the day. I had this error with a custom control. Don't know if the same
applies to webparts but you may need to add the "assembly=" attribute. See
my sample code and resolution in the posts. Dave

"ah**********@gmail.com" wrote:
Hello

I am creating a ASP.net 2.0 webpart for use in an aspx just for
learning purpose.
My webpart code is very simple :

Now when I use this webpart DLL as a reference in website project and
include this line

<%@ Register TagPrefix="custom" Namespace="aspwebpart" %>

The custom keywork is not usable inside the aspx page.
These lines throw the error that FeaturePart is not recognized
<WebPartsTemplate>

<custom:FeaturePart ID="my" Runat="Server" />
</WebPartsTemplate>

Any Ideas??

================================================== =========

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;

namespace aspwebpart
{

public class FeaturePart:WebPart
{
const string str =
"server=10.111.121.24;Trusted_Connection=true;Data base=NorthWind";
const string query = "Select * from products";

public FeaturePart()
{
this.Title = "Feature Part";
}

protected override void RenderContents(HtmlTextWriter writer)
{

DataTable pt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(query, str);
da.Fill(pt);
Random rnd = new Random();
DataRow row = pt.Rows[rnd.Next(pt.Rows.Count)];

writer.Write((string)row["ProductName"]);
writer.Write(string.Format("-{0:c}", row["UnitPrice"]));

base.RenderContents(writer);
}

}
}

Regards

Madhur

Jul 21 '06 #2
Hi Dave

Gr8 !!! That did the trick. Thanks very much
Clear me one thing, what does Assembly attribute refers to?
Does it refer dll file name or Assembly is an attribute stored inside
..NET metadata.

I am asking it because when I appended .dll in front of it, it again
gave the same error.

Madhur
Dave wrote:
Madhur,

Check out my post "Error creating control..Server tag error" from earlier in
the day. I had this error with a custom control. Don't know if the same
applies to webparts but you may need to add the "assembly=" attribute. See
my sample code and resolution in the posts. Dave

"ah**********@gmail.com" wrote:
Hello

I am creating a ASP.net 2.0 webpart for use in an aspx just for
learning purpose.
My webpart code is very simple :

Now when I use this webpart DLL as a reference in website project and
include this line

<%@ Register TagPrefix="custom" Namespace="aspwebpart" %>

The custom keywork is not usable inside the aspx page.
These lines throw the error that FeaturePart is not recognized
<WebPartsTemplate>

<custom:FeaturePart ID="my" Runat="Server" />
</WebPartsTemplate>

Any Ideas??

================================================== =========

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;

namespace aspwebpart
{

public class FeaturePart:WebPart
{
const string str =
"server=10.111.121.24;Trusted_Connection=true;Data base=NorthWind";
const string query = "Select * from products";

public FeaturePart()
{
this.Title = "Feature Part";
}

protected override void RenderContents(HtmlTextWriter writer)
{

DataTable pt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(query, str);
da.Fill(pt);
Random rnd = new Random();
DataRow row = pt.Rows[rnd.Next(pt.Rows.Count)];

writer.Write((string)row["ProductName"]);
writer.Write(string.Format("-{0:c}", row["UnitPrice"]));

base.RenderContents(writer);
}

}
}

Regards

Madhur
Jul 21 '06 #3
Madhur,

The assembly name refers to the project that contains my custom controls.
In my case my project name was CustomControls, so when I compile it becomes
CustomControls.dll. The assembly attribute must then match the name of the
dll..."Assembly="CustomControls" without the .dll extension though..go figure.

"ah**********@gmail.com" wrote:
Hi Dave

Gr8 !!! That did the trick. Thanks very much
Clear me one thing, what does Assembly attribute refers to?
Does it refer dll file name or Assembly is an attribute stored inside
..NET metadata.

I am asking it because when I appended .dll in front of it, it again
gave the same error.

Madhur
Dave wrote:
Madhur,

Check out my post "Error creating control..Server tag error" from earlier in
the day. I had this error with a custom control. Don't know if the same
applies to webparts but you may need to add the "assembly=" attribute. See
my sample code and resolution in the posts. Dave

"ah**********@gmail.com" wrote:
Hello
>
I am creating a ASP.net 2.0 webpart for use in an aspx just for
learning purpose.
My webpart code is very simple :
>
Now when I use this webpart DLL as a reference in website project and
include this line
>
<%@ Register TagPrefix="custom" Namespace="aspwebpart" %>
>
The custom keywork is not usable inside the aspx page.
These lines throw the error that FeaturePart is not recognized
<WebPartsTemplate>
>
<custom:FeaturePart ID="my" Runat="Server" />
</WebPartsTemplate>
>
Any Ideas??
>
================================================== =========
>
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
>
namespace aspwebpart
{
>
public class FeaturePart:WebPart
{
const string str =
"server=10.111.121.24;Trusted_Connection=true;Data base=NorthWind";
const string query = "Select * from products";
>
public FeaturePart()
{
this.Title = "Feature Part";
}
>
protected override void RenderContents(HtmlTextWriter writer)
{
>
DataTable pt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(query, str);
da.Fill(pt);
Random rnd = new Random();
DataRow row = pt.Rows[rnd.Next(pt.Rows.Count)];
>
writer.Write((string)row["ProductName"]);
writer.Write(string.Format("-{0:c}", row["UnitPrice"]));
>
base.RenderContents(writer);
}
>
}
}
>
Regards
>
Madhur
>
>

Jul 21 '06 #4

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

Similar topics

2
by: Kristoffer Arfvidson | last post by:
Ok, so a new question... Im building my page as dynamic as I can... meaning that I have basicly one aspx page that controls everything... so, I solved this by sending different variables to the...
1
by: Michael Skelton | last post by:
Hi I've created a new custom Web control. I have tried to customize the assembly attribute TagPrefix . However, each time I drag my custom control onto a form, it's TagPrefix is still "cc1". What...
0
by: G Dean Blake | last post by:
( I know this should be posted in the BuildingControls forum but I don't get much help over there) I'm going through this book on asp.net server control development. I wrote a control using the...
2
by: Keith Harris | last post by:
When you drag a web user control onto your design surface, VS.NET automatically assigns the tagprefix = uc1. Does anyone know how to change the default tagprefix for all web controls you drag...
1
by: Michael Tissington | last post by:
I'm trying to convert a project from VS2003 to VS2005 After conversion all of my TagPrefix are not recognized in the body. <%@ Register TagPrefix="Oaklodge" TagName="Curve"...
5
by: Arthur Dent | last post by:
Can anyone tell me what the equivalent in 2005 is for 2003's line <Assembly: System.Web.UI.TagPrefix("Temporal.WEB.Controls", "twebc")> in the AssemblyInfo file? I have an assembly of my own...
1
by: wapsiii | last post by:
I'd like to set the tagprefix of my server controls automatically when they are dragged to the webform. My code reads <Assembly: TagPrefix("CtrlLib", "abc")> Namespace CtrlLib ...
4
by: | last post by:
Is there a way to define a controls tagprefix in the control itself? When I drop a control on a web page it's tagprefix defaults to uc1, as expected. Where can I set it so that it's default tag...
0
by: Sergei Shelukhin | last post by:
We have a custom (ascx) control that is used in several pages. In ASP.NET 1.1, we had register tagprefix specified in every page that uses this control; in 2.0, I decided to add this control to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.