.ascx file erro need some help

Posted on 2005-05-13
Last Modified: 2011-04-14
I create a .ascx file where I have a form, but when I load my .aspx page, on the page_load event I have setup some text to give some value to the forms in the .ascx file, but I'm getting this error msg.

Server Error in '/' Application.

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30390: '_ASP.babysitter_ascx.txtfname' is not accessible in this context because it is 'Protected'.

Source Error:


Line 7:              myConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/database/babysitter.mdb") & ";")
Line 8:              myConn.Open()
Line 9:              babysitterform1.txtfname.Text = "Ennio"
Line 10:             
Line 11:             myConn.Close()
And here is my .ASPX file

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="bsf" TagName="babysitterform" src="babysitter.ascx" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Web.Security" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<script language="vb"  runat="server">

Sub Page_Load( S As Object, E As EventArgs)
      If Not isPostBack Then
            babysitterform1.txtfname.Text = "Ennio"
      End If
End Sub

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<form runat="server">
<bsf:babysitterform ID="babysitterform1" runat="server" />
Question by:Ennio
    LVL 27

    Expert Comment

    Hi Ennio:
    Have a look at the declaration of txtfnname in the code behind
    Change its declaration to Public

    LVL 1

    Author Comment

    Hi Dabas,
    I was looking on my .ascx and I think I did something wrong, I don't have any declaretion... Here is the .ascx file

    First Name: <asp:TextBox ID="txtfname" runat="server" /><br />
    Last Name: <asp:TextBox ID="txtlname" runat="server" /><br />

    How should I declare this?? I was look in a book, but it really doesn't show how to do that.
    it just tell me do add some fields
    LVL 27

    Expert Comment

    NOT in the .ascx but in the .ascx.vb

    LVL 1

    Author Comment

    hum.. I don't have one, this book really Su.....

    Do you know where can I find some information about it?
    What I should have on my .ascx.vb??
    LVL 27

    Accepted Solution

    Just double click anywhere within your design screen


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now