Contents tagged with ASP.NET

  • How to fix "Validation(): Element 'xxxx' is not supported" and "Unrecognized tag prefix or device filter 'asp'"

    Since about a month ago,I started to get validation warnings at design time on asp.net server controls (any control actually) within the html design view for VS 2010 or later,intellisense on all controls would not work at all,the messages like:

    Unrecognized tag prefix or device filter 'asp'
    Validation(): Element 'Label' is not supported.
    Validation(): Element 'GridView' is not supported
    ....etc

    The compilation done successfully but the warnings still exist and intellisense is not working at the source tab

    I tried to reset the settings of Visual studio ,disabled all extensions and few other ideas but none of them solved the issue,I got stuck.

    I did a search over the internet about this issue and found this article on Doug Kennard's blog:
    http://www.gotknowhow.com/articles/fix-validation-element-not-supported-visual-studio-2010

    Splendid,that article is a life savior,the idea is to remove the folder "ReflectedSchemas" from paths:

    Win XP : C:\Documents and Settings\{username}\Application Data\Microsoft\VisualStudio\10.0\ReflectedSchemas

    Win Vista / 7: C:\Users\{username}\AppData\Roaming \Microsoft\VisualStudio\10.0\ReflectedSchemas

    Note: make sure that "Show hidden files, folders, and drives" is selected from Folder Options,also don't forget to close VS before deleting the folder.

    This solution should work for any Visual studio version,keep in mind that you have to use the correct VS version number i.e

    Visual studio 2010 : %appdata%\Microsoft\VisualStudio\10.0\ReflectedSchemas
    Visual studio 2012: %appdata%\Microsoft\\VisualStudio\11.0\ReflectedSchemas
    Visual studio 2013: %appdata%\Microsoft\VisualStudio\12.0\ReflectedSchemas
    ..etc

  • Failed to load viewstate.The control tree into which viewstate is being loaded...etc

    Two days ago,a colleague of mine tried to publish an asp.net website (which is built in VS2008 using framework 3.5) to our server,he configured everything in IIS (he made sure that the selected asp.net version is 2.0) and launched the website..at first it was working great but when he tried to click on a specific treeview...BOOM..:

    "Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request."

    In that page there were these control: a TreeView and a Placeholder,when the user selects any node then it's controls will be created dynamically into that placeholder..for the first time it's working fine but when (s)he select another node then that issue appears.

    He called me to help him with this issue,for me this is the first time I see such an issue,scratch my head then I decided to eliminate the possibilities of this issue one by one,at the development machine it's working perfectly,he published the website at the local IIS and again..it's working perfectly,I took a copy of the website and published it into my laptop but no issues at all,so this is means that it's not an issue in the code.

    So there is something missing/wrong in our server [it has Windows Server 2003],we went to the server and checked on the web-config and the configurations on IIS...nothing wrong so far,so I decided to check if the framework 3.5 is installed or not and the answer: it wasn't installed

    Of course he assumed that it was installed and there was nothing to tell if it wasn't from the "ASP.Net version" in IIS because frameworks 3.0 and 3.5 will not be listed there [2.0 will be listed there instead],the only way to check if it was installed or not is to search for the framework in this path:[WINDOWS Folder]\Microsoft.NET\Framework or check if it was installed in Add or remove programs.

    The obvious solution for his case: We installed Framework 3.5 SP1 into our server,did a restart to the machine and it worked !

    If anyone faced the same issue and solved it using the same solution or with a different one please post it here to share experience.

  • How to use jQuery Date Range Picker plugin in asp.net

    I stepped by this page: http://www.filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/ and let me tell you,this is one of the best and coolest daterangepicker in the web in my opinion,they did a great job with extending the original jQuery UI DatePicker.Of course I made enhancements to the original plugin (fixed few bugs) and added a new option (Clear) to clear the textbox. In this article I well use that updated plugin and show you how to use it in asp.net..you will definitely like it.

  • Reset the controls within asp placeholder

    I use placeholders very much in many projects,but in one of the projects I was asked to reset the controls within a specific placeholder to their original state after the user has finished from inserting his/her data.

    As everyone of us know,to keep the controls within a placeholder from disappearing after postbacks you have to recreate them,we add such a code in i.e. page_load,the controls will be recreated and their values will be loaded from viewstate (for some of them like textbox,checkboxs,..etc) automatically,that placeholder contains only textboxs so what I need is to block/ loading/clear that viewstate after inserting the data.

    First thought: Customizing placeholder

    I thought about it and tried overriding many methods but no success at all...maybe I'm missing something not sure.

    Second thought: recreate the controls 2 times:

    In page_load,I recreate the controls within that placeholder then in button click (the button that saves user's data) I recreate them once more and it worked!

    I just thought of sharing my experience in that case with everyone in case anyone needed it,any better suggestion(s) is welcomed.

P.S. In addition to blogging, I am also now using Twitter for quick updates and to share links. Follow me at: twitter.com/alaa9jo