Custom Control Problem in ASP.NET
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcontrolsvb' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Info@slickworm.com
-- Moved from [aspclient] to [aspngcontrolsvb] by Charles M. Carroll <Click here to reveal e-mail address> --

So I believe to have crated all of this correctly, but my machine has made it
clear that I haven't.

The Following Is my Custom Control code(It has been compiled into a dll and put
into a subdirectory name "bin", the filename is WebCustomControl1):

Option Explicit On
Option Strict On

Imports System
Imports System.Web
Imports System.Web.UI
Imports Microsoft.VisualBasic

Namespace SimpleControlSamples
Public Class InnerContent : Inherits Control
Protected Overrides Sub Render(ByVal output As HtmlTextWriter)

If HasControls() And TypeOf Controls(0) Is LiteralControl Then
output.Write("<H2>Your Message: " & CType(Controls(0),
LiteralControl).Text & "</H2>")
End If
End Sub 'Render
End Class 'InnerContent
End Namespace 'SimpleControlSamples

Next is my .aspx page, which i named "Try.aspx":

<%@ page Language="VB" %>
<%@ Register TagPrefix="SimpleControlSamples" Namespace="SimpleControlSamples"
Assembly="WebControlLibrary1" %>

<html>

<body>

<form method="POST" runat="server">

<SimpleControlSamples:InnerContent id="MyControl" runat="server">
My Message Is Inside the Control Tag!!!!
</SimpleControlSamples:InnerContent>

</form>

</body>

</html>

The error that i am getting is saying that it cannot find
SimpleControlSamples.InnerContent. It is obviously there, or i thnk it is. Can
someone who is .NET fluent help me please?

--Aldo Sarmiento

Reply to this message...
 
    
Brian Bilbro (VIP)
How are you creating your control on the page? Since you have this:

[Original message clipped]

then the tag should look like this:

<SimpleControlSamples:InnerContent id="MySampleControl runat="server" />

Also, the bin directory needs to be off of the *application* root (just
making sure you are doing that).

HTHs,
Brian

[Original message clipped]

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com

Reply to this message...
 
 
System.Web.UI.HtmlTextWriter
System.Web.UI.LiteralControl




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com