Issue: FileUpload inside MultiView not working on First Postback in ASP.Net No Comments



I had this problem in one of my project job, it took me sometime to figure out what was the culprit.
However, when I look at the source view in the browser, the “form” element has no enctype=”multipart/form-data” attribute which is required in uploading a file. While the FileUpload element was in the 3rd view, I need to put a fake or dummy FileUpload that will always visible (style=”display:none”) to engine.

Asp.Net Mvc no intellisense in views No Comments



I have experienced this problem after installing visual studio 2013 web express, doing google answers resolved this problem.
To resolve this problem, find the web.config under “Views” folder and add the highlighted element below.

  1.  <appSettings>
  2.      <add key="webpages:Version" value="3.0.0.0"/>
  3.  </appSettings>

Sql Server Installation Wizard Disappear No Comments


I have this problem when I tried reinstalling SQL SERVER 2008 R2 and SQL SERVER 2012. Just following this thread from Microsoft, it solved this problem.

Here’s how I did it
1. Find the SqlSetup.log in temp folder by typing %temp%.
2. If the you see this type of error “Error: Cannot load .Net security policy file” then, your good (just execute step 3)
3. Bring up the command promp (runAs admin) and type this – “C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CasPol.exe -machine -reset”.

Error:Configuration system failed to initialize exception in Vb.net No Comments



I had this problem when I have converted my VB.Net Project Framework from 3.5 to 4.
My solution is to delete the app.config, after that I open the project properties, goto Settings Tab and just alter / add a dummy text and save it, Visual Studio will generate a new app.config.

Error: Mixed mode in assembly in .NET 4 No Comments



This error usually appears after converting a project from .net any lower verson to .net 4 and this project also had referenced another .net project with lower version.
To solve this error simply add the below configuration into your project app.config or web.config inside element.

  1. <startup useLegacyV2RuntimeActivationPolicy="true">
  2.     <supportedRuntime version="v4.0"/>
  3. </startup>

Issue: SelectedItem of the Listview is delayed No Comments



I have developed an asp.net website and I used the Listview control for some of the website navigation and define its style.
Now, the problem was when you clicked the link on the first time, the selected item would not be highlighted as what I have defined the style when selected, and on the second.. third.. time of selection, the previous selected link would be the one highlighted and not the current one. As usual GOOGLE is the world wide web friend, I ran into a blog that encountered the same problem as mine.
Here’s what I have done to solve the problem.

On the SelectedIndexChanging event of the Listview, I set the SelectedIndex and reload the data of the listview and now its working.

  1. protected void lvwSequence_SelectedIndexChanging(object sender, ListViewSelectEventArgs e)
  2. {
  3.             lvwSequence.SelectedIndex = e.NewSelectedIndex;
  4.             this._processPresenter.LoadWFSequence();
  5. }

Issue:Listview inside UpdatePanel not working No Comments



I had this web project using ASP.Net, its all good until I had to use a ListView control to create a list clickable items. And, because I want it to be more responsive so I wrapped it with UpdatePanel, however, when you click a link inside it, it would do a full Postback instead of partial Postback. I also took me sometime to figured it out. One solution that I used was I added an ClientIDMode=”AutoID” on the page directive.

How to concatenate rows in sql server using XML No Comments


  1. SELECT DISTINCT
  2.       fileid
  3.     , STUFF((
  4.         SELECT N', ' + CAST([filename] AS VARCHAR(255))
  5.         FROM tblFile f2
  6.         WHERE f1.fileid = f2.fileid —- string with grouping by fileid
  7.         FOR XML PATH ('')), 1, 2, '') AS FileNameString
  8. FROM tblFile f1

Error: Unable to find assembly Serialization Exception No Comments



I’ve got this issue when we’re developing an Microsoft office Addin integration project, however, the assembly causing this error has been tested and deployed with our different products and projects and we have not encountered this type of error until we have use this one of our Microsoft office Addin project.
Luckily, after googling we have fixed it by refering this blog.
And, here’s the code I use.

  1. AppDomain.CurrentDomain.AssemblyResolve +=
  2.         new ResolveEventHandler(CurrentDomain_AssemblyResolve);
  3.  
  4.     // deserialization code here
  5.  
  6.     // *** Unhook the event handler for the rest of the application
  7.     AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(CurrentDomain_AssemblyResolve);

  1. /// <summary>
  2. /// Handle custom loading of the current assembly if the assmebly won't
  3. /// resolve with the name.
  4. /// </summary>
  5. /// <param name="sender"></param>
  6. /// <param name="args"></param>
  7. /// <returns></returns>
  8.  
  9.  
  10. static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
  11. {
  12.     try
  13.     {
  14.         Assembly assembly = System.Reflection.Assembly.Load(args.Name);
  15.         if (assembly != null)
  16.             return assembly;
  17.     }
  18.     catch { ;}
  19.  
  20.     return Assembly.GetExecutingAssembly();            
  21. }

Asp.Net Routing not working on IIS No Comments


I have just started using routing in aspx, I thought it was cool and it gave you a more meaningful URI.
Now, when I tried to deploy it on the staging Server running IIS7, it was not cool anymore because the website didn’t run at all.
Spending a bit time searching on the web, at last I get it working.

Here’s what I use and it work.

  1. <system.web>
  2.   <httpModules>
  3.     <add name="RoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  4.   </httpModules>
  5. </system.web>
  6. <system.webServer>
  7.   <modules runAllManagedModulesForAllRequests="true">
  8.     <add name="RoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  9.   </modules>
  10. </system.webServer>