Sal-laS
Sal-laS

Reputation: 11649

cannot resolve symbol

i have made a simple table (lets call it volunteers), but when i want to call it in my code behind Visual studio can not recognize it. The error is cannot resolve symbol 'volunteers'.

here is the code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="root_VerifyUsers.aspx.cs" 
     MasterPageFile="~/Root.Master" %>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

               <p>
                   <asp:Table runat="server" ID="volunteers" ForeColor="Green" Width="100%" Height="85%"  BorderColor="Red"></asp:Table>

                   <asp:TableHeaderCell ID="NationalId" runat="server">National Id</asp:TableHeaderCell>
                   <asp:TableHeaderCell ID="Email" runat="server">Email</asp:TableHeaderCell>
               </p>

</asp:Content>

that is behind code:

public partial class RootVerifyUsers : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {


        TableRow tr = new TableRow();
        TableCell fname = new TableCell();

        TableCell NationalId=new TableCell();
        tr.Cells.Add(NationalId);
        volunteers.Rows.add(tr);

    }

}

Upvotes: 0

Views: 2852

Answers (3)

Sal-laS
Sal-laS

Reputation: 11649

The problem solved by adding this attribute

Inherits="Library.Account.RootVerifyUsers"

Thanks everyone for helping

Upvotes: 1

Joe Ratzer
Joe Ratzer

Reputation: 18569

You have asp:TableHeaderCell with an id of NationalId and a local variable called NationalId:

TableCell NationalId=new TableCell();

That isn't going to work... Change one of them to start with..

Also, have a look at the examples on MSDN here, to correctly structure your <asp:Table...

Upvotes: 0

donstack
donstack

Reputation: 2715

Your TableHeaderCell should be inside Table tag

<asp:Table runat="server" ID="volunteers" ForeColor="Green" Width="100%" Height="85%"  BorderColor="Red">

               <asp:TableHeaderCell ID="NationalId" runat="server">National Id</asp:TableHeaderCell>
               <asp:TableHeaderCell ID="Email" runat="server">Email</asp:TableHeaderCell>
</asp:Table>

Upvotes: 0

Related Questions