Ala'a Alnajjar

Everything about ASP.Net

Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox'

I faced this issue yesterday,it was very strange because it doesn't make sense at all.

I have a master page and 1 content page,in that content page there is only one TextBox and an Ajax Editor (from ASP.NET AJAX Control Toolkit),no more no less.

I tried to run the page but the debugger doesn't compile at all,it keeps showing this error message:

Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBox'

It was hopeless,there isn't any server side code or even any JavaScript blocks,nothing!

After a long analysis at the source/html of my page and trying every possibility I finally found what caused the issue that I won't guess it at all:

EMPTY TITLE for my content page


That is what caused the issue,I was surprised,after removing/setting a value for the title the problem solved!

I hope my experience with this issue might help someone else,if anyone face the same issue and solved it in the same way or in a different way then please post it here,this will surely help others as well.
Posted: Oct 14 2010, 01:32 PM by alaa9jo | with 4 comment(s) |
Filed under: ,

Comments

Robert Carter said:

From someone who usually backs MS, not their finest moment

# October 14, 2010 12:36 PM

ganesh said:

hi.. i too faced same error since giving title to the page..this is coz i given textbox id as 'title' and now i solved by renaming the textbox id to 'txttitle'. now working fine..

thanks for this article :)

# March 17, 2011 5:50 AM

nodeFedEpoere said:

Thx for this great information that you are shareing with us

# January 31, 2012 8:20 AM

Mike_Tek said:

FYI if you name the textbox "Title" same damn thing, changed to Title1 and that worked too.

# March 8, 2012 9:29 PM