http://forums.asp.net/thread/1495802.aspx
And your form.designer.cs is no longer code generating anything, and you are using a master page – then you can probably fix it by doing the following:
- Open your master page in the designer by double clicking it in visual studio.
- With it left open, open your suspect aspx file
- Right click on the toolbox in visual studio and click ‘reset toolbox’
- Wait for this to complete, switch to markup view on the aspx file, and drop a new script manager from the ajax extensions group onto the page.
- Save the file, check that your designer is now regenerating code.
- Delete the script manager you dropped on the aspx
Hope this helps, (It took me a while to work that one out!)
-EDIT:
If you are getting warnings along the lines of “Generation of designer file failed: Unknown server tag ‘ajaxToolkit:’
or ‘asp:ScriptManager’
You should place these registrations in your aspx:
Or, ensure that your controls section in your web config is defined correctly:
<controls>
<add tagPrefix=”asp” namespace=”System.Web.UI” assembly=”System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
<add tagPrefix=”asp” namespace=”System.Web.UI.Controls” assembly=”System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
<add tagPrefix=”ajaxToolkit” namespace=”AjaxControlToolkit” assembly=”AjaxControlToolkit”/>
</controls>
This should fix any designer regeneration issues…
Cheers,
Matthew Cosier
Did this post help you? If so, feel free to donate me some cash by clicking here!
Thanx…
Simple solution fixed my headache
This is simply great.i would have never thought about this solution.I guess i installed ,uninstalled various versions of Atlas ,but toolbox has to be refreshed manually it seems .
Thanks alot!!!! This was stressing me out very badly for a while!
This used to work for me, but no longer does for some reason. It doesn’t even work in a brand new ajax-enabled web site.
hmmm…
The System.Web.UI.Controls is not a valid namespace is the error I get. The darn designer.cs keeps trying to add :
protected System.Web.UI.ScriptManager ScriptManager;
to the designer.cs and it throws that error. I was hoping the above would fix it, but it didnt, oh well.
Have you tried adding the appropriate assembly as a reference in your project?
Also, the only reason it would be adding that is if you had declared a script manager in your markup – so if you don’t want it there, remove it from your markup and let the designer sync up.
Chances are that you have added an assembly reference to the CTP of atlas, or perhaps asp.net ajax pre 1.0 RC, where the namespace was not System.*
Check the version of your referenced assembly – this could be it.
HTH,
Matthew Cosier
Hi I have a question about registering the assembly. I’m still a bit new to ASP.NET. I was getting the … “is not a known element” message and I’ve since… installed VS 2005 service pack 1, flushed the intellisense, and tried your fix but I’m still seeing weird behavior. When I drag a ScriptManager control onto the page it also adds this “Register Assembly=”System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″
Namespace=”System.Web.UI” TagPrefix=”asp”" I’ve tried adding the Microsoft ASP.NET 2.0 AJAX Extensions Toolbox Package as a Reference in my website but that didn’t seem to fix the problem (even after a restart of VS). Any ideas what I’m missing? Thanks!
Thank you so much
Legend!! Thanks so much…was getting rather frustrated.
Men rulez, it runs, thanks for your solution
There’s no need to Reset the toolbox. Just open your master and aspx pages in Design View will fix the problem.
Would encase ScriptManager like this work
<script>
<asp:ScriptManager runat="server">
</asp:ScriptManager>
</script>
Hi all, I was getting a
Error 42 Type ‘System.Web.UI.ScriptManager’ is not defined.
I tried everything, made sure everything was set up correctly, web.config was done right etc etc .. Fixed it in the end by simply right clicking on my project and choosing Add Reference. Then browsing to where the System.Web.Extensions.dll was and selecting that. It added the reference into the references folder and the error went away. Just mentioning it here in case anyone else has issues.
hi,
Solution was really nice but it does not solve my problem actually my page is in nested master page and from there i have applied ur solution but it still shows same problem.
Also after running the project whatever i do on page while parsing the page it gves error “Ambigous match found” however if i remove all ajax stuff from page then it works fine.
can u help regarding these?
Thanx.
Thanks, it worked.
thekaran.com
Didn’t work so well for me, after doing this fix all my other pages had numerous errors with unknown controls. Heres how I fixed it:
In the controls tag of web.config
add tagPrefix=”asp” namespace=”System.Web.UI” …etc…
add tagPrefix=”asp” namespace=”System.Web.UI.Controls”…etc…
add tagPrefix=”ajaxToolkit” namespace=”AjaxControlToolkit” assembly=”AjaxControlToolkit”
add tagPrefix=”ajax” namespace=”System.Web.UI”…etc…
add tagPrefix=”ajax” namespace=”System.Web.UI.Controls”…etc…
Then I changed the opening and closing tags for the offending scriptmangager to ajax:ScriptManager
Awesome! When I open my master page in design view, it fixes it. Thanks to whoever posted that.
Thanks Dude! Microsoft being Microsoft… always gives me a headache on stuff like this!
Superb!!! This fixed all the issues in my page..great men!!
I was getting same error, I tried to convert a project which had a master page. I tried to install on page and master page and did not fix problem.
I looked at the ajaxcontrol samples and noticed the scriptmanager tag did not have an ID.
So if I put asp:ScriptManager runat=”Server” it works fine.
Thanks!
Thank you very much
Great post. The comment about ScriptManager having an ID when it shouldn’t was the cause of my problem as well. Thanks to whoever posted that solution.
Dragging the control from the toolbox automatically puts in the ID, which confused me.
Thanks too!
Thank you very much!
If you found your way into this thread because you are getting this warning in VS2005 when viewing an aspx page with ScriptManager control on it:
“Namespace or type specified in the Imports ‘System.Web.UI.Controls’ doesn’t contain any public member or cannot be found. ”
It’s because you put both “add tagPrefix…”s in your web.config file as suggested up at the top of this page. You only need the first one near as I can tell.
Lifesave. How did you figure this out?
Found an easier solution for me.
1. Remove MasterPageFile=”~/YourMasterPageName.master” from the page directive.
2. Switch to design view (yes, I know all of your content controls say ‘Error’)
3. Switch back to Source and put MasterPageFile=”~/YourMasterPageName.master” back in the page directive.
4. Switch to design view.
5. Switch back to Source…. all better.
Thanks a lot.. htank u very much… i was able to solve the problem
make sure system.web.extensions is referencing the correct version
Thanks for posting this solution. It worked for me.
You are my guru.
I’ll be naming my son after you.
Thanks
My Problem is solved
thanks ryan, your fix was the only one that worked for some reason :S
Ryan (21:10:41) :
Found an easier solution for me.
1. Remove MasterPageFile=”~/YourMasterPageName.master” from the page directive.
2. Switch to design view (yes, I know all of your content controls say ‘Error’)
3. Switch back to Source and put MasterPageFile=”~/YourMasterPageName.master” back in the page directive.
4. Switch to design view.
5. Switch back to Source…. all better.
Yes.. this Master Page thing worked nicely for me too…
Hi.
Iam getting An error:’ScriptManager’ ia not a known element .
Adding the below statement in web.config solved my problem.
add tagPrefix=”ajax” namespace=”System.Web.UI.Controls”…etc
thanks.
Thanks!
simple solution. big help.
Thanks a lot.
Thank you thank you thank you!!!
Your clearly described steps fixed the problem for me! Thanks again!
This blog just saved me big headaches, thanks for posting.
what if i’m not using master pages? i’m just using simple .aspx form from a asp.net website. thanks for the input.
I did a funny thing.
1. I removed (ctrl+x) the script manager
from the markup.
2. saved and built
3. The error panel demanded for one script manager.
4. I added the same line at the same place. Saved and ran the application.
I was not really hopeful but it worked!
And yes, the application I am using does not have master pages. Maybe Bryan could try this.
wow… works like charm. you saved me by hitting my head into my own computer …..
God bless
Excellent work, I really appretiate this, it saved my working weekends
[...] http://cosier.wordpress.com/2006/12/22/element-%e2%80%9cscriptmanager%e2%80%9d-is-not-a-known-elemen... [...]
Thank you. It was very helpful.
This was a great help. I am sure people like you make life of other developers a lot easite. kewl…
Thanks from another satisfied customer.
thank you, thank you, thank you! banging my head against the wall doesn’t begin to cover it:)
THIS Post fixed my problem:
Anonymous (06:22:00) :
I tried everything, made sure everything was set up correctly, web.config was done right etc etc .. Fixed it in the end by simply right clicking on my project and choosing Add Reference. Then browsing to where the System.Web.Extensions.dll was and selecting that. It added the reference into the references folder and the error went away.
My colleages had a ASP.NET Website, and i have a ASP.NET Web Application.
I had to add this library also as a reference and they did not. And now after HOURS of searching the project compiled immediately and ajax worked!
Thanks for the tip…. it helps a looot!!!!
Simply Fantastic… superb
I love u .. u have no idea how much u help me !!!
That’s great !!!
I meet the same problem when use master page.
Now it is OK.
Thanks.