Avatar of GIANTOCR
GIANTOCR

asked on 

ASP.net - How to access controls in VB.net code behind

I am working on an ASP.net project in VS 2008, using Visual Basic. This project was started by someone else.

I have added some new controls to an existing UpdatePanel. I am unable to access the new controls in the visual basic code behind. When I type in the controls' names I would expect Intellisense to recognize the control and allow me to access its methods, properties and whatnot.

Strange thing is that the existing controls that were in the Update Panel before I started modifying it are accessible through Intellisense in visual basic.

I can not find where the settings for the existing controls are any different from the new controls.

<asp:UpdatePanel ID="SeriesUpdatePanel" runat="server" 
        UpdateMode="Conditional" ChildrenAsTriggers="False" >
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="ButtonIndexChanged" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="RemoveSeriesButton" EventName="Click" />
    <asp:PostBackTrigger ControlID="SeriesEditOK" />
    </Triggers>
    <ContentTemplate>
        <asp:Panel ID="seriespopuppanel" runat="server" class="seriespopuppanel" 
        Height="339px" Width="281px">
        <table>
                    </tr>
                        <tr>
   
                <td class="style2" colspan="3" style="width:80%;">
                    <table style="width:100%;border:solid"><tr><th>Edit Data Series</th></tr></table></td>

            </tr>
            <tr>
                <td class="style1">
                    <asp:ListBox ID="SeriesListBox" rowspan="3" runat="server" onchange="IndexChanged()"></asp:ListBox>
                </td>
                <td class="style2">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1">
                    </td>
                <td class="style2">
                    Visible</td>
                <td>
                    <input ID="VisibleCheckbox" type="checkbox" runat="server"/></td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;</td>
                <td class="style2">
                    Show Limits</td>
                <td>
                    <input ID="ShowLimitsCheckbox" type="checkbox" runat="server" /></td>
            </tr>
                        <tr>
                <td class="style1">
                    <asp:Button ID="SeriesEditOK" Text="OK" Width="60px" runat="server" onclientclick="UpdateSeriesProperties()"/>
                            </td>
                <td class="style2">
                    Show Marker</td>
                <td>
                    <input ID="ShowMarkerCheckbox" type="checkbox" runat="server" /></td>
            </tr>
                        <tr>
                <td class="style1">
                    &nbsp;</td>
                <td class="style2">
                    Y Axis</td>
                <td>
                    <select ID="YAxisSelect" name="D2" runat="server">
                        <option>1</option>
                        <option>2</option>
                    </select></td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;</td>
                <td class="style2">
                    Autoscale</td>
                <td>
                    <input ID="AutoScaleCheckbox" type="checkbox" runat="server" /></td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;</td>
                <td class="style2">
                    Y Axis Min</td>
                <td>
                    <asp:TextBox ID="AxisMinTextBox" runat="server"></asp:TextBox>
                </td>
            </tr>
                        <tr>
                <td class="style1">
                    &nbsp;</td>
                <td class="style2">
                    Y Axis Max</td>
                <td>
                    <asp:TextBox ID="AxisMaxTextBox" runat="server"></asp:TextBox>
                            </td>
            </tr>
                        <tr>
                <td class="style1">
                    <asp:Button ID="SeriesEditCancel" runat="server" Text="Cancel" Width="60px" />
                            </td>
                <td class="style2">
                    <asp:Button ID="RemoveSeriesButton" runat="server" Text="Remove" />
                            </td>
                <td>
                    <asp:Button id="ButtonIndexChanged" Text="Index Changed" style="display: none;" OnClick="SeriesListBox_SelectedIndexChanged" runat="server" />
                    </td>
            </tr>
                        </tr>
                        <tr>
                <td class="style1">
                    &nbsp;</td>
                <td class="style2">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    </asp:Panel>
    </ContentTemplate>
    </asp:UpdatePanel>

Open in new window


In the code above, all the controls are accessible with the exception of "AutoScaleCheckbox", "AxisMinTextBox" and "AxisMaxTextBox".

When I type in these control names in visual basic I get the following error:

Name '' is not declared.

I would appreciate any help you can provide.

Thanks
ASP.NETVisual Basic.NET

Avatar of undefined
Last Comment
adriankohws
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of adriankohws
adriankohws
Flag of Singapore image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of Gerry Bartley
Gerry Bartley
Flag of Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of GIANTOCR
GIANTOCR

ASKER

Thanks for the help. I played around and found that no matter where I added a control I could not get to in in code behind.

The website I had open was the same name but different version and folder than one I had previously opened in VS. When I opened it originally VS put a (2) after the name.

I closed the website, saved it with a new name. Then restarted my computer and when I opened the website up again in VS I could add new controls and get to them in code behind.
Avatar of adriankohws
adriankohws
Flag of Singapore image

Yes. That was my intention :). Sometimes, it just gone wild. You found out what happened, congrats. Because from what I see, it isn't possible, they must be able to be accessible.
ASP.NET
ASP.NET

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

128K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo