I cant reach the panelID from the code behind cs file..
<asp:Panel ID="Panel1" runat="server" ondatabinding="Panel1_DataBinding"
Visible="False">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</asp:Panel>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class PanelControl : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Panel1. --- intellisense doesnt work and there is a red line underneath it!!
}
protected void Panel1_DataBinding(object sender, EventArgs e)
{
}
}
<%@ Page Title="" Language="C#" MasterPageFile="~/Forum.master" AutoEventWireup="true" CodeFile="PanelControl.aspx.cs" Inherits="PanelControl" %>
<script runat="server">
protected void ButtonPanel1_Click(object sender, EventArgs e)
{
}
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p>
<br />
</p>
<p>
</p>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Panel ID="Panel1" runat="server">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</asp:Panel>
<asp:Button ID="ButtonPanel1" runat="server" Text="Panel 1"
onclick="ButtonPanel1_Click" />
<p>
</p>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<asp:Panel ID="Panel2" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:Panel>
<asp:Button ID="ButtonPanel2" runat="server" Text="Panel 2" />
</asp:Content>
as razlebe indicated, you may just have to rebuild.
About once a day, my code will show that a bunch of code is invalid and just doing a rebuild fixes it.
If that does not work, your example shows that you are using a “partial class” and check the designer.cs class to make sure that your variable for the panel is defined.
for example: