-1

I received this error when trying to put a couple of C# projects live. The sites were working locally in VS 2010 but on live they threw the following error:

CS0117: 'System.Web.UI.HtmlControls.HtmlAnchor' does not contain a definition for 'Text'

This was the code having the issue in the code file of the master page:

litHome.Text = "active";

In the source the master page I had this:

<li><a href="Default.aspx" class="<asp:Literal ID="litHome" runat="server" />">home</a></li>

The error being thrown appeared to think I was setting the text property of an HTML Anchor.

I've just fixed this myself but after not being able to find the solution on here (or Google) I thought I'd post it for anyone else having the problem. Please see my comments below as I'm not allowed to answer this yet.

  • Eh, what have you posted? You've just shown an error message! – Dave Mar 21 '13 at 15:32
  • 1
    HtmlAnchor doesn't have a `Text` property. It's a too localized problem, you shoud drop the question itself. It's my opinion. – Matías Fidemraizer Mar 21 '13 at 15:33
  • Did you convert the control from any other type (having `Text` property) to `HtmlAnchor`, which could cause this? – shahkalpesh Mar 21 '13 at 15:36
  • Left that as a comment as not allowed to post the answer for a few hours yet. Dave Rook: Yes, I was trying to post the answer afterwards Matías Fidemraizer: Yes I know, this was in a literal. shahkalpesh: No, this appears to be something new I've just experience in VS 2010, not sure why I'm only seeing it now. – Toby Gunston Mar 21 '13 at 15:47

2 Answers2

0

sir

html controls doesn't have (.Text) extensions in this case you can use (.Value) instead to solve your problem ,it will return u same thing which in returned in case of .Text.If u still face ant problem just let me know which control u r using

in code behind

string abc=htmlTextbox.Value;

Rohit
  • 31
  • 2