Compilation Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • preeti13
    New Member
    • Aug 2007
    • 67

    Compilation Error

    Hi friends i am getting the error in my application i don't know what to do please help me.i am useing a data bimder into my text box here is the my code

    Code:
    <%@ Page language="c#" Codebehind="Accomplishment.aspx.cs" AutoEventWireup="false" Inherits="Accomplishments.Accomplishment" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    	<HEAD>
    		<title>Accomplishment</title>
    		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    		<meta content="C#" name="CODE_LANGUAGE">
    		<meta content="JavaScript" name="vs_defaultClientScript">
    		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    	</HEAD>
    	<body>
    		<form id="Form1" method="post" runat="server">
    			<table height="100%" cellSpacing="0" width="700" align="center" border="1"> 
    				<tr>
    					<td height="50"><IMG src="header.jpg" width="700"></td>
    				</tr>
    				<tr>
    					<td vAlign="top">
    						<table cellPadding="5" width="700">
    							<tr>
    								<td>FirstName:
    									<asp:textbox id="txtFirstName" ReadOnly="True" Runat="server"></asp:textbox>LastName:
    									<asp:textbox id="txtLastName" ReadOnly="True" Runat="server"></asp:textbox>
    									<
    									<asp:TextBox ID="txtemployee"   Visible=False Runat=server text='<%# DataBinder.Eval(Container.DataItem,"employeeid")%>'>
    									</asp:TextBox>
    								</td>
    							</tr>
    							<tr>
    								<td>Login
    									<asp:textbox id="txtLogin" ReadOnly="True" Runat="server"></asp:textbox>Dept:<asp:textbox id="txtdept" ReadOnly="True" Runat="server"></asp:textbox>
    								</td>
    							</tr>
    							<tr>
    								<td>DateCreated:
    									<asp:textbox id="txtdatecreated" ReadOnly="True" Runat="server"></asp:textbox>ProejctName:
    									<asp:dropdownlist id="drpProject" Runat="server" AutoPostBack="True">
    										<asp:ListItem Value="">Select a Project</asp:ListItem>
    										<asp:ListItem Value="01">Employee Nominations</asp:ListItem>
    										<asp:ListItem Value="02">Accomplishments</asp:ListItem>
    									</asp:dropdownlist>
    									<asp:RequiredFieldValidator ID="Project" Runat="server" ErrorMessage="*" Display="Dynamic" ControlToValidate="drpProject"></asp:RequiredFieldValidator>
    									<asp:dropdownlist id="drpMonth" Runat="server" AutoPostBack="True">
    										<asp:ListItem Value="">Select a Month</asp:ListItem>
    										<asp:ListItem Value="01">January</asp:ListItem>
    										<asp:ListItem Value="02">February</asp:ListItem>
    										<asp:ListItem Value="03">March</asp:ListItem>
    										<asp:ListItem Value="04">April</asp:ListItem>
    										<asp:ListItem Value="05">May</asp:ListItem>
    										<asp:ListItem Value="06">June</asp:ListItem>
    										<asp:ListItem Value="07">July</asp:ListItem>
    										<asp:ListItem Value="08">August</asp:ListItem>
    										<asp:ListItem Value="09">September</asp:ListItem>
    										<asp:ListItem Value="10">October</asp:ListItem>
    										<asp:ListItem Value="11">November</asp:ListItem>
    										<asp:ListItem Value="12">December</asp:ListItem>
    									</asp:dropdownlist>
    								</td>
    							</tr>
    							<tr>
    								<td><asp:textbox id="txtdescription" Runat="server" TextMode="MultiLine" Height="150" Width="600"></asp:textbox></td>
    							</tr>
    							<tr>
    								<td><asp:button id="cmdSubmit" Runat="server" Text="Submit"></asp:button></td>
    							</tr>
    						</table>
    					</td>
    				</tr>
    			</table>
    		</form>
    	</body>
    </HTML>

    and here is the erro i am getting

    Code:
    Server Error in '/Accomplishments' Application.
    --------------------------------------------------------------------------------
    
    Compilation Error 
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
    
    Compiler Error Message: CS0117: 'System.Web.UI.Control' does not contain a definition for 'DataItem'
    
    Source Error:
    
     
    
    Line 23: 									<asp:textbox id="txtLastName" ReadOnly="True" Runat="server"></asp:textbox>
    Line 24: 									<
    Line 25: 									<asp:TextBox ID="txtemployee"   Visible=False Runat=server text='<%# DataBinder.Eval(Container.DataItem,"employeeid")%>'>
    Line 26: 									</asp:TextBox>
    Line 27: 								</td>
     
    
    Line


    please help me do you ay other way to do this i am passing the employeeid through the data binder how i acn do this please help me
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Container.DataI tem is your offending line.
    You will need to type-cast that object to whatever it's REAL object type is to make use of that property.

    Comment

    • preeti13
      New Member
      • Aug 2007
      • 67

      #3
      hey do you know which property do i need to use instead of Container.DataI tem because i tried so many things but did not get the right anwers please me .

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        What is Container? If it's a textbox you would use .Text

        Comment

        • preeti13
          New Member
          • Aug 2007
          • 67

          #5
          hey now error is changed it is show this error now
          Code:
          Compiler Error Message: CS0246: The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference?)
          what should i do with this please help me

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            Uhhh you should be using Container.Text, not just "Text"

            Comment

            Working...