Error Creating Control CustomWebControls1 Unknown Server Tag cc1: CustomWebControls

Discussion in 'ASP .Net Web Controls' started by Ryan, Feb 16, 2007.

  1. Ryan

    Ryan Guest

    I am trying to program a modified version of the password reset
    control. I have written the following code (below). When I add it to
    my tool box and then attempt to add it to the page, I get the message:

    Error Creating Control CustomWebControls1 Unknown Server Tag cc1:
    CustomWebControls

    I think, though am not sure, that this has something to with my nested
    class and the toolbox tag in the source code:

    <DefaultProperty("Text"),
    ToolboxData("<{0}:AdministratorDrivenSecurityControls.PasswordReset
    runat=server></{0}:CustomWebControls.CustomWebControls>")> _

    Does anyone know why I am getting this error and how to correct it?

    Thank you!
    Ryan
    ------------CODE BELOW---------------

    Imports System
    Imports System.Collections.Generic
    Imports System.ComponentModel
    Imports System.Text
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    Imports System.Web.Security
    Imports System.Web.Configuration


    Namespace CustomWebControls
    Public Class AdministratorDrivenSecurityControls
    Protected Shared Function
    GetDefaultMemberStoreConnectionString(Optional ByVal path = "") As
    String
    Dim webConfig As System.Configuration.Configuration

    Dim mbrshpSection As MembershipSection
    'Dim mbrshpConnectionStringName As String
    Dim curPage As New System.Web.UI.Page

    webConfig =
    WebConfigurationManager.OpenWebConfiguration(path)
    mbrshpSection = webConfig.GetSection("system.web/
    membership")
    Return
    (webConfig.ConnectionStrings.ConnectionStrings(mbrshpSection.Providers(mbrshpSection.DefaultProvider).Parameters("connectionStringName")).ToString)

    End Function
    <DefaultProperty("Text"),
    ToolboxData("<{0}:AdministratorDrivenSecurityControls.PasswordReset
    runat=server></{0}:CustomWebControls.CustomWebControls>")> _
    Public Class PasswordReset
    Inherits CompositeControl

    'Object Child Controls
    Private cpdChangePassword As ChangePassword
    Private WithEvents btnChangePassword As Button
    Private WithEvents ddlSecurityQuestion As DropDownList
    Private txtSecurityAnswer As TextBox
    Private vldValidator As RequiredFieldValidator


    Dim curPage As System.Web.UI.Page
    Dim mbrshpConnectionString As String

    'Event Handlers
    Private Sub btnChangePassword_OnClick(ByVal sender As
    Object, ByVal e As System.EventArgs) Handles btnChangePassword.Click
    Me.Page.Response.Write("Test")


    End Sub
    Private Sub ddlSecurityQuestion_OnInit(ByVal sender As
    Object, ByVal e As System.EventArgs) Handles ddlSecurityQuestion.Init
    Me.Page.Response.Write("Test2")
    End Sub
    'Properties
    Public ReadOnly Property SecurityQuestion() As Integer
    Get
    EnsureChildControls()
    Return ddlSecurityQuestion.SelectedValue
    End Get
    End Property

    Public Property SecurityAnswer() As String
    Get
    EnsureChildControls()
    Return txtSecurityAnswer.Text
    End Get
    Set(ByVal value As String)
    EnsureChildControls()
    txtSecurityAnswer.Text = value
    End Set
    End Property

    Protected Overrides Sub CreateChildControls()
    curPage = Me.Page
    mbrshpConnectionString =
    GetDefaultMemberStoreConnectionString(curPage.Server.MapPath(curPage.Request.ApplicationPath))

    cpdChangePassword = New ChangePassword
    cpdChangePassword.ID = "cpdChangePassword"
    Me.Controls.Add(cpdChangePassword)

    ddlSecurityQuestion = New DropDownList
    ddlSecurityQuestion.ID = "ddlSecurityQuestion"
    Me.Controls.Add(ddlSecurityQuestion)

    txtSecurityAnswer = New TextBox
    txtSecurityAnswer.ID = "txtSecurityAnswer"
    Me.Controls.Add(txtSecurityAnswer)

    vldValidator = New RequiredFieldValidator
    vldValidator.ID = "vldValidator"
    vldValidator.ControlToValidate = cpdChangePassword.ID
    vldValidator.ErrorMessage = "(Required)"
    vldValidator.Display = ValidatorDisplay.Dynamic
    Me.Controls.Add(vldValidator)

    btnChangePassword = New Button
    btnChangePassword.ID = "btnChangePassword"
    Me.Controls.Add(btnChangePassword)
    'btnChangePassword.CommandName = "ChangePassword"

    End Sub
    End Class
    End Class
    End Namespace
     
    Ryan, Feb 16, 2007
    #1
    1. Advertising

  2. Ryan

    Teemu Keiski Guest

    Has it added the @Register directive correctly on top of the Page?

    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net


    "Ryan" <> wrote in message
    news:...
    >I am trying to program a modified version of the password reset
    > control. I have written the following code (below). When I add it to
    > my tool box and then attempt to add it to the page, I get the message:
    >
    > Error Creating Control CustomWebControls1 Unknown Server Tag cc1:
    > CustomWebControls
    >
    > I think, though am not sure, that this has something to with my nested
    > class and the toolbox tag in the source code:
    >
    > <DefaultProperty("Text"),
    > ToolboxData("<{0}:AdministratorDrivenSecurityControls.PasswordReset
    > runat=server></{0}:CustomWebControls.CustomWebControls>")> _
    >
    > Does anyone know why I am getting this error and how to correct it?
    >
    > Thank you!
    > Ryan
    > ------------CODE BELOW---------------
    >
    > Imports System
    > Imports System.Collections.Generic
    > Imports System.ComponentModel
    > Imports System.Text
    > Imports System.Web.UI
    > Imports System.Web.UI.WebControls
    > Imports System.Web.Security
    > Imports System.Web.Configuration
    >
    >
    > Namespace CustomWebControls
    > Public Class AdministratorDrivenSecurityControls
    > Protected Shared Function
    > GetDefaultMemberStoreConnectionString(Optional ByVal path = "") As
    > String
    > Dim webConfig As System.Configuration.Configuration
    >
    > Dim mbrshpSection As MembershipSection
    > 'Dim mbrshpConnectionStringName As String
    > Dim curPage As New System.Web.UI.Page
    >
    > webConfig =
    > WebConfigurationManager.OpenWebConfiguration(path)
    > mbrshpSection = webConfig.GetSection("system.web/
    > membership")
    > Return
    > (webConfig.ConnectionStrings.ConnectionStrings(mbrshpSection.Providers(mbrshpSection.DefaultProvider).Parameters("connectionStringName")).ToString)
    >
    > End Function
    > <DefaultProperty("Text"),
    > ToolboxData("<{0}:AdministratorDrivenSecurityControls.PasswordReset
    > runat=server></{0}:CustomWebControls.CustomWebControls>")> _
    > Public Class PasswordReset
    > Inherits CompositeControl
    >
    > 'Object Child Controls
    > Private cpdChangePassword As ChangePassword
    > Private WithEvents btnChangePassword As Button
    > Private WithEvents ddlSecurityQuestion As DropDownList
    > Private txtSecurityAnswer As TextBox
    > Private vldValidator As RequiredFieldValidator
    >
    >
    > Dim curPage As System.Web.UI.Page
    > Dim mbrshpConnectionString As String
    >
    > 'Event Handlers
    > Private Sub btnChangePassword_OnClick(ByVal sender As
    > Object, ByVal e As System.EventArgs) Handles btnChangePassword.Click
    > Me.Page.Response.Write("Test")
    >
    >
    > End Sub
    > Private Sub ddlSecurityQuestion_OnInit(ByVal sender As
    > Object, ByVal e As System.EventArgs) Handles ddlSecurityQuestion.Init
    > Me.Page.Response.Write("Test2")
    > End Sub
    > 'Properties
    > Public ReadOnly Property SecurityQuestion() As Integer
    > Get
    > EnsureChildControls()
    > Return ddlSecurityQuestion.SelectedValue
    > End Get
    > End Property
    >
    > Public Property SecurityAnswer() As String
    > Get
    > EnsureChildControls()
    > Return txtSecurityAnswer.Text
    > End Get
    > Set(ByVal value As String)
    > EnsureChildControls()
    > txtSecurityAnswer.Text = value
    > End Set
    > End Property
    >
    > Protected Overrides Sub CreateChildControls()
    > curPage = Me.Page
    > mbrshpConnectionString =
    > GetDefaultMemberStoreConnectionString(curPage.Server.MapPath(curPage.Request.ApplicationPath))
    >
    > cpdChangePassword = New ChangePassword
    > cpdChangePassword.ID = "cpdChangePassword"
    > Me.Controls.Add(cpdChangePassword)
    >
    > ddlSecurityQuestion = New DropDownList
    > ddlSecurityQuestion.ID = "ddlSecurityQuestion"
    > Me.Controls.Add(ddlSecurityQuestion)
    >
    > txtSecurityAnswer = New TextBox
    > txtSecurityAnswer.ID = "txtSecurityAnswer"
    > Me.Controls.Add(txtSecurityAnswer)
    >
    > vldValidator = New RequiredFieldValidator
    > vldValidator.ID = "vldValidator"
    > vldValidator.ControlToValidate = cpdChangePassword.ID
    > vldValidator.ErrorMessage = "(Required)"
    > vldValidator.Display = ValidatorDisplay.Dynamic
    > Me.Controls.Add(vldValidator)
    >
    > btnChangePassword = New Button
    > btnChangePassword.ID = "btnChangePassword"
    > Me.Controls.Add(btnChangePassword)
    > 'btnChangePassword.CommandName = "ChangePassword"
    >
    > End Sub
    > End Class
    > End Class
    > End Namespace
    >
     
    Teemu Keiski, Feb 18, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q3VydF9DIFtNVlBd?=

    asp: replaced with cc1: for all controls

    =?Utf-8?B?Q3VydF9DIFtNVlBd?=, Nov 8, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    342
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Nov 8, 2005
  2. shruds
    Replies:
    1
    Views:
    829
    John C. Bollinger
    Jan 27, 2006
  3. =?Utf-8?B?RGF2ZQ==?=
    Replies:
    1
    Views:
    7,489
    =?Utf-8?B?RGF2ZQ==?=
    Jul 20, 2006
  4. Fred
    Replies:
    1
    Views:
    1,635
  5. dliu
    Replies:
    0
    Views:
    2,267
Loading...

Share This Page