0

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);

    }

}

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Sal-laS
  • 11,016
  • 25
  • 99
  • 169
  • 1
    Cannot resolve what symbol? That's not the whole error. Why wouldn't you post the whole error? Trying to make it a challenge? – Ant P Sep 18 '13 at 10:21
  • 1
    Sorry for careless, but i am new in asp and not going to make challenge. – Sal-laS Sep 18 '13 at 10:29
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Sep 18 '13 at 10:40
  • Any plug ins you are using by chance ?? – R.C Sep 18 '13 at 10:48

3 Answers3

1

The problem solved by adding this attribute

Inherits="Library.Account.RootVerifyUsers"

Thanks everyone for helping

Sal-laS
  • 11,016
  • 25
  • 99
  • 169
0

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...

Joe Ratzer
  • 18,176
  • 3
  • 37
  • 51
0

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>
donstack
  • 2,557
  • 3
  • 29
  • 44