Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 21st, 2004, 03:57 AM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom Controls

I'm new to ASP. I'm trying to setup a custom control and am going through the tutorials in the SDK .
Here is the code

Namespace customcontrols
    Public Class clientclickbutton
        Inherits Button
        Protected Overrides Sub addattributestorender(ByVal writer As HtmlTextWriter)
            MyBase.AddAttributesToRender(writer)
            writer.AddAttribute("OnClick", "Alert('Thanks');")
        End Sub
    End Class
End Namespace


<%@ Register TagPrefix="Custom" Namespace="CustomControls.MyControl" Assembly = "CustomControls" %>
<%@ Page Language="vb" AutoEventWireup="false" src="WebForm1.aspx.vb" Inherits="WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            This button handles a client-side click event.
            <Custom:ClientClickButton Id="Button" BackColor="Red" runat="server" />
            <br>
            <br>
        </form>
    </body>
</HTML>

After this I get an error "File or assembly name CustomControls, or one of its dependencies, was not found.." with the @Register line highlighted.
I can't imagine this should be all that difficult and I'm probably missing something very basic here.
Anybody have any pointers for me?





Reply With Quote
  #2 (permalink)  
Old May 21st, 2004, 07:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

You have to add the project name to the register statement:

<%@ Register TagPrefix="Custom" Namespace="<project name>.CustomControls" Assembly = "<project name>" %>

If customcontrols is the name of your project, you are also using customcontrols as the namespace, so it would look like CustomControls.Customcontrols.<etc>. Plus, I believe you don't reference the control in the namespace parameter in the Register tag.

Hope that helps,

Brian
Reply With Quote
  #3 (permalink)  
Old May 23rd, 2004, 11:04 PM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Brian,
Thanks for the help.
Assembly name error is removed. Now it gives error in namespace decalration.
'Type 'Button' is not defined'

here is the code..
Namespace customcontrols
    Public Class clientclickbutton
        Inherits Button
        Protected Overrides Sub addattributestorender(ByVal writer As HtmlTextWriter)
            MyBase.AddAttributesToRender(writer)
            writer.AddAttribute("OnClick", "Alert('Thanks');")
        End Sub
    End Class
End Namespace

Can u pls help me to resolve this error.

Thanks,
Apry

Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Controls pro-logic C# 2008 aka C# 3.0 1 November 26th, 2008 09:55 AM
Custom Controls kcis8rm ASP.NET 2.0 Basics 2 July 2nd, 2007 04:07 PM
Custom Controls bmains ASP.NET 1.x and 2.0 Application Design 1 April 8th, 2004 05:26 PM
Custom Controls bmains VS.NET 2002/2003 3 February 5th, 2004 08:54 AM



All times are GMT -4. The time now is 07:23 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.