Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Compiler Error Message: CS0103: The name 'IsInEditMode' does not exist in the current context

Source Error:

Line 22:         <asp:TemplateField HeaderText="Comments">
Line 23:             <itemtemplate>
Line 24:                 <asp:Label ID="lblComments" Visible='<%# !(bool) IsInEditMode %>' runat="server" Text='<%# Bind("Comments") %>'>
Line 25:                 <asp:TextBox ID="txtComments" Visible='<%# IsInEditMode %>' runat="server">
Line 26:             </itemtemplate>

Thank for valuable reply
Posted
Updated 28-Nov-11 20:43pm
v3
Comments
thatraja 29-Nov-11 2:34am    
Show your code-behind

Here what is IsInEditMode?
2011999 29-Nov-11 2:57am    
Text Box is edit mode
thatraja 29-Nov-11 3:15am    
I know what you are trying, Is IsInEditMode a variable in code-behind? or where? Give us complete details

C#
<asp:textbox id="txtComments" visible='<%# Eval("IsinEditMode")%>' runat="Server"> 

Try this.
 
Share this answer
 
v2
Comments
2011999 29-Nov-11 2:40am    
Compiler Error Message: CS0103: The name 'IsInEditMode' does not exist in the current context

Source Error:

Line 22: <asp:TemplateField HeaderText="Comments">
Line 23: <itemtemplate>
Line 24: <asp:Label ID="lblComments" Visible='<%# !(bool) IsInEditMode %>' runat="server" Text='<%# Bind("Comments") %>'>
Line 25: <asp:TextBox ID="txtComments" Visible='<%# IsInEditMode %>' runat="server">
Line 26:

i got this error
S.P.Tiwari 29-Nov-11 3:50am    
<asp:TemplateField HeaderText="Comments">

<asp:Label ID="lblComments" Visible='<%# Eval(IsInEditMode) == false ? "True" : "false" %>' runat="server" Text='<%# Eval("Comments") %>'>

<asp:TextBox ID="txtComments" Visible='<%# IsInEditMode %>' runat="server">

try this. if still you get same error then register you namespace(that has the property "IsInEditMode") on aspx page
try like this..

ASP.NET
<asp:templatefield headertext="Comments" xmlns:asp="#unknown">
   <asp:label id="lblComments" visible="<%# !Eval("IsInEditMode") %>" runat="server" text="<%# Bind("Comments") %>"></asp:label>

<asp:textbox id="txtComments" visible="<%# Eval("IsInEditMode") %>" runat="server"></asp:textbox>

</asp:templatefield>


hope it works..
 
Share this answer
 
Comments
2011999 29-Nov-11 2:45am    
not working above code
thatraja 29-Nov-11 2:49am    
Reply to my comment

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