Control Reference

Posted on 2006-04-19
Last Modified: 2008-01-09

i am trying to add a control to my ASP.NET app.  I have added it in the usual way through the tool box.  i can paste the control on to a form and the control wotrks ok.  

The problem when I am writing my code ito access properties etc it get errors saying that it is not a member of the form. I knew I was accessing the right name of the control so I tried the page and the code worked !!

I must be missing a refernece from somewhere that is stopping visual studio from accessing the control properly but not sure where!
Question by:Kevin Robinson
    LVL 23

    Expert Comment

    Where are you trying to access the properties of that control? Client side or server side?

    If you can post some code to show how you are declaring the c ontrol and how you are accesing the properties, that would be great.
    LVL 3

    Author Comment

    by:Kevin Robinson
    I am tring to access the controls properties in the usual way = .  Visual studio does not seem to see the control so this does not bring up intilisence, but the web page works ok in the browser.

    This works

    <%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %>

    <FTB:FreeTextBox id="FreeTextBox1" runat="server" ToolbarLayout="StylesMenu,|Bold,Italic,Underline,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImage,InsertRule|Cut,Copy,Paste;Undo,Redo,Print" AutoGenerateToolbarsFromString="True" BreakMode="LineBreak" ButtonImagesLocation="InternalResource" DisableIEBackButton="True" HtmlModeCss="volunteer.css" HtmlModeCssClass="volunteer.css" ToolbarBackgroundImage="True" UpdateToolbar="False">

    This shows an error in VS but does work
    Freetextbox1.text = "Some Text"

    LVL 23

    Expert Comment

    Declare variable FreeTextBox1 in your code behind file.
    LVL 37

    Accepted Solution

    this happens to me sometimes..especially using copy and pasting both vs2003 and vs2005...
    but visual studio is not adding it to the designer , "generated code" section if youre in vs2005, from solution explorer, click the "show hidden files" button, open the designer page and look for:

        Protected WithEvents yourControlName As System.Web.UI.WebControls.yourControlType

    and I bet it's missing....add it and you will have intellisense again

    if youre in vs2003, expand the "generated code" section and look for the same line of code, it won't be there...add it to the section...
    LVL 37

    Expert Comment

    by:samtran0331 you're missing something like:

        Protected WithEvents FreeTextBox1 As FreeTextBoxControls.FreeTextBox

    also, you do have the dll added as a reference right?
    and you did "import" it to the top of the codebehind too right?...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    758 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

    13 Experts available now in Live!

    Get 1:1 Help Now