Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 24th, 2005, 03:17 PM
Authorized User
 
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Is this a custom server control? <uc1:##>

i ran into this at work

<uc1:WUC_ShoppingCart id=wucForm runat="server"></uc1:WUC_ShoppingCart>

i don't know what it means, can anyone out there dissect it? thanks guys!

 
Old June 25th, 2005, 03:12 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Look at the top of the page you found this on. There should be something that resembles this:

<%@ Register TagPrefix="uc1" ... %>

This indicates your application is using some custom controls that are either found in an ASCX file in the application itself, or in an assembly that is referenced by your application.

-Peter
 
Old June 26th, 2005, 11:56 AM
Authorized User
 
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks planoie... i ended up asking the boss. it's pretty cool. another question... if you can... so does that mean it is an object or a class or how does one define a control... like <uc1:##>

 
Old June 26th, 2005, 01:26 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Any control in ASP.NET is a class and therefore an object (because all classes derive from the .NET System.Object class). ASP.NET controls are all derived from System.Web.UI.Control, even the Page itself.

When you want to use a control (custom or otherwise) you use control tags:

   <asp:button ...>

It happens that the ASP.NET runtime automatically knows about the XML namespace "ASP" which is an alias for System.Web.UI.WebControls. Regular HTML tags (<input type="button"...>) live in the System.Web.UI.HtmlControls namespace and ASP.NET knows they are declared as regular HTML (no tag prefix).

When you want to use a custom control (user control from an ASCX or a custom server control found in a third party assembly) you need to tell ASP.NET how you are going to refer to it. That is what the @ Register directive is for. In the case of your situation:

   <%@ Register TagPrefix="uc1" ... %>

You are telling ASP.NET: I am going to use the tag prefix "uc1" and here is where you can find the source for the control(s) under that prefix.

You can register both a single ASCX:

   <%@ Register TagPrefix="uc1" TagName="aControl" Src="aControl.ascx" %>

where the Src attribute tells you where the ASCX can be found, or you can register a tag namespace when you have 1 or more server controls in an referenced assembly:

   <%@ Register TagPrefix="ms" NameSpace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %>

Here's the MSDN article on the register directive:
http://msdn.microsoft.com/library/en...onregister.asp

-Peter
 
Old June 27th, 2005, 04:49 PM
Authorized User
 
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks again, Peter. You're going to be my new best friend! Seriously thanks so much! Hopefully one day I'll be knowledgeable enough to help out like you're helping out.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 8: <asp:image> inside <a> & ext.CSS (pg. 274) epc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 July 12th, 2008 04:37 AM
create <ul> with alternating class on <li> element Brian Campbell XSLT 2 November 3rd, 2006 06:07 PM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM
<STRONG> vs <B> and <EM> vs <I> anshul HTML Code Clinic 12 September 1st, 2004 05:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.