[Resolved] Can't reference server control in code-behind/IntelliSense
.Question:
I've got the following control on my aspx page:
<asp:DropDownList ID="favList" runat="server" AutoPostBack="true">
<asp:ListItem Value="" Text="--" />
</asp:DropDownList>
I have three other drop down lists on the page that are working fine. However this one doesn't seem to come up under intellisense when I'm in my code-behind. If I type "favList." ....I get nothing. But I can still programmatically reference the control using
Dim favoritesDropDown As DropDownList = DirectCast(FindControl("favList"), DropDownList)
I only recently added the control to the page, which has been in existence for some time now...could that have anything to do with it?
Solution:
Try the following steps :
- Switch the page View to design mode this may refresh the designer file and reflect the control in IntelliSense.
- Make sure that the control is not a child of another control.
Hope it helps :)
Source : Can't reference server control in code-behind/intellisense?