Error Setting user control property at web form

Discussion in 'ASP .Net' started by Amir Eshterayeh, Nov 27, 2003.

  1. Dear Friends
    Hope things goes well to you. I have this problem. Would you please give me
    your solution?

    I want to change a property that I define on my user control in my web form
    that contains that user control.
    but when I want to set the property of user control at my web form, got this
    error
    c:\inetpub\wwwroot\test4\WebForm1.aspx.vb(19): Name 'Uc1' is not declared.
    How can I solve this problem. Please help.
    Thank you very much in advance and please me your answer to my email:
    if possible.

    Best Regards
    Amir Eshterayeh



    this is the code behind (vb code) of my web form

    ----------------------------------------------------------------------------
    -----------------------------
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    Uc1.Username = "Message text changed!"
    End Sub
    ----------------------------------------------------------------------------
    -----------------------------

    This is the user control code
    ----------------------------------------------------------------------------
    -----------------------------

    Public MustInherit Class uc
    Inherits System.Web.UI.UserControl
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Public Username As String

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    Label1.Text = Username
    End Sub

    End Class
    ----------------------------------------------------------------------------
    -----------------------------
    this is the user control HTML
    ----------------------------------------------------------------------------
    -----------------------------

    <%@ Control Language="vb" AutoEventWireup="false" Codebehind="uc.ascx.vb"
    Inherits="test4.uc"
    TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

    <asp:Label id="Label1" runat="server">Label</asp:Label>
    ----------------------------------------------------------------------------
    -----------------------------
    this is the HTML Code my Web form that contains my user control
    ----------------------------------------------------------------------------
    -----------------------------
    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
    Inherits="test4.WebForm1"%>
    <%@ Register TagPrefix="uc1" TagName="uc" Src="uc.ascx" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
    <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema"
    content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">

    <uc1:uc id="Uc1" runat="server"></uc1:uc>

    </form>
    </body>
    </HTML>
    ----------------------------------------------------------------------------
    -----------------------------
     
    Amir Eshterayeh, Nov 27, 2003
    #1
    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. jamesd
    Replies:
    2
    Views:
    868
    jamesd
    Aug 15, 2006
  2. Nathan Sokalski
    Replies:
    25
    Views:
    1,452
    Nathan Sokalski
    Mar 4, 2010
  3. Amir Eshterayeh

    Error Setting user control property at web form

    Amir Eshterayeh, Nov 27, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    187
    Teemu Keiski
    Nov 27, 2003
  4. Amir Eshterayeh

    Error Setting user control property at web form

    Amir Eshterayeh, Nov 27, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    136
    Teemu Keiski
    Nov 27, 2003
  5. David Webb
    Replies:
    6
    Views:
    200
    David Webb
    Dec 30, 2004
Loading...

Share This Page