Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i got the follwing error.pls help me to resolve this error.

'System.Web.UI.WebControls.TextBox' does not contain a definition for 'text' and no extension method 'text' accepting a first argument of type 'System.Web.UI.WebControls.TextBox' could be found (are you missing a using directive or an assembly reference?)
XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Details.aspx.cs" Inherits="Details" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        .style1
        {
            width: 10px;
            height: 39px;
        }
        .style2
        {
            height: 39px;
        }
    </style>
<script language="javascript" type="text/javascript">
/*function aprl_disp()
{
  document.getElementById("m1").visible=true;

}*/

function lg_display()
{
    window.open("logout.aspx");
}
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Image ID="Image1" runat="server" AlternateText="cpcl"
            DescriptionUrl="~/App_Data/images/cpcl.jpg" Height="156px"
            ImageUrl="~/App_Data/images/cpcl.jpg" Width="250px" />
    <br />
    NAME:<asp:TextBox id="t1" runat="server" Text="XXXX"></asp:TextBox>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    PR NO:<asp:TextBox id="t2" runat="server" Text=""></asp:TextBox>
        <br />
        <h1 style="width: 1368px; background-color: #C0C0C0; font-weight: 600; font-size: xx-large; font-style: normal; font-variant: normal; color: #800000;">
    <marquee style="height: 57px; width: 1366px">DASHBOARD</marquee></h1>
    <table>
        <tr>
    <td style="background-color:"Maroon" align="center" class="style2">
    <asp:Menu ID="m1" runat="server" BackColor="#993333" Font-Bold="True"
            Font-Size="XX-Large" ForeColor="Black" Width="211px">
            <DynamicHoverStyle BackColor="#990033" />
            <DynamicMenuItemStyle BackColor="#993333" />
            <Items>
                <asp:MenuItem Text="TRAVEL" Value="GATE PASS">
                    <asp:MenuItem Text="AIR" Value="VISITOR" NavigateUrl="~/air.aspx"></asp:MenuItem>
                    <asp:MenuItem Text="CAR" Value="MATERIAL" NavigateUrl="~/car.aspx"></asp:MenuItem>
                </asp:MenuItem>
                <asp:MenuItem Text="GATE PASS" Value="GATE PASS">
                    <asp:MenuItem Text="VISITOR" Value="VISITOR" NavigateUrl="~/visitor.aspx"></asp:MenuItem>
                    <asp:MenuItem Text="MATERIAL PASS" Value="MATERIAL PASS"
                        NavigateUrl="~/material.aspx"></asp:MenuItem>
                </asp:MenuItem>
            </Items>
        </asp:Menu>

    </td>
    <td style="background-color:"Maroon" align="center" class="style1">
    <asp:Menu ID="m2" runat="server" BackColor="#993333" Font-Bold="True"
            Font-Size="XX-Large" ForeColor="Black" Width="211px" Height="73px"
            >
            <DynamicHoverStyle BackColor="#990033" />
            <DynamicMenuItemStyle BackColor="#993333" />
            <Items>
                <asp:MenuItem Text="MIS" Value="MIS">
                    <asp:MenuItem Text="REPROT1" Value="REPROT1" NavigateUrl="~/report1.aspx"></asp:MenuItem>
                    <asp:MenuItem Text="REPORT2" Value="REPORT2" NavigateUrl="~/report2.aspx"></asp:MenuItem>
                    <asp:MenuItem Text="REPORT3" Value="REPORT3" NavigateUrl="~/report3.aspx"></asp:MenuItem>
                    <asp:MenuItem Text="REPORT4" Value="REPORT4" NavigateUrl="~/report4.aspx"></asp:MenuItem>
                </asp:MenuItem>
            </Items>
        </asp:Menu>
    </td>
    <td align="center" class="style2">
    <asp:Menu ID="m3" runat="server" BackColor="#993333" Font-Bold="True"
            Font-Size="XX-Large" ForeColor="Black" Width="211px" Height="73px"
            >
            <DynamicHoverStyle BackColor="#990033" />
            <DynamicMenuItemStyle BackColor="#993333" />
            <Items>
                <asp:MenuItem Text="SURVEY" Value="SURVEY" NavigateUrl="~/main.aspx">
                </asp:MenuItem>
            </Items>
        </asp:Menu>
            </td>
     <td align="center" class="style2">
    <asp:Menu ID="m5" runat="server" BackColor="#993333" Font-Bold="True"
            Font-Size="XX-Large" ForeColor="Black" Width="211px" Height="73px"
            >
            <DynamicHoverStyle BackColor="#990033" />
            <DynamicMenuItemStyle BackColor="#993333" />
            <Items>
                <asp:MenuItem Text="NEWS" Value="LOGOUT">
                </asp:MenuItem>
            </Items>
        </asp:Menu>
            </td>
    <td align="center" class="style2">
    <asp:Menu ID="m6" runat="server" BackColor="#993333" Font-Bold="True"
            Font-Size="XX-Large" ForeColor="Black" Width="211px" Height="73px"
            >
            <DynamicHoverStyle BackColor="#990033" />
            <DynamicMenuItemStyle BackColor="#993333" />
            <Items>
                <asp:MenuItem Text="KYD" Value="LOGOUT" NavigateUrl="~/kyd.aspx">
                </asp:MenuItem>
            </Items>
        </asp:Menu>
            </td>
    <td align="center" class="style2">
    <asp:Menu ID="m4" runat="server" BackColor="#993333" Font-Bold="True"
            Font-Size="XX-Large" ForeColor="Black" Width="211px" Height="73px" >
                        <DynamicHoverStyle BackColor="#990033" />
            <DynamicMenuItemStyle BackColor="#993333" />
            <Items>
                <asp:MenuItem Text="LOGOUT" Value="LOGOUT" NavigateUrl="~/logout.aspx">
                </asp:MenuItem>
            </Items>
        </asp:Menu>
            </td>
     <td align="center" class="style2">
     <asp:Menu ID="Menu1" runat="server" BackColor="#993333" Font-Bold="True"
            Font-Size="XX-Large" ForeColor="Black" Width="211px" Height="73px"
            >
            <DynamicHoverStyle BackColor="#990033" />
            <DynamicMenuItemStyle BackColor="#993333" />
            <Items>
                <asp:MenuItem Text="ADMIN" Value="LOGOUT" NavigateUrl="~/admin.aspx">
                </asp:MenuItem>
            </Items>
        </asp:Menu>
        </td>
    </tr>
    <tr>
    <td>


    </td>
    </tr>
    </table>

    </div>
    </form>
</body>
</html>




C#
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Details : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        t2.text = "welcome"
    }

}







Thanks a lot.....
Posted
Updated 13-Dec-14 1:25am
v2
Comments
DamithSL 13-Dec-14 4:53am    
which code line? please include the code

1 solution

TextBox havin property called Text it not text, c# is case sensitive
 
Share this answer
 
Comments
Member 11278307 13-Dec-14 7:29am    
Thanks for valuable solution.But i have an another error.The name 't2' does not exist in the current context".pls help me.
DamithSL 13-Dec-14 8:18am    
what is the visual studio version and are you working on asp.net web application project or web site?
Member 11278307 13-Dec-14 8:21am    
Microsoft Visual Studio 2008.i'm working in asp.net Wenapplication.Thankyou somuch.......
DamithSL 13-Dec-14 8:25am    
have you import this page from some other old web site?
DamithSL 13-Dec-14 8:33am    
1. take a backup of your web application project folder
2. delete defaut page from the site, go go project folder and delete all default.* files
3. right click on solution explorer window and click add new item and add new web form called Default.aspx
3. copy the form content in the backup default aspx page to new aspx page
3. press f7 key and go to code behind and start typing code, intellisense will show you the control names and propertis while you typing if you done it correctly

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900