These three mechanisms transport information from one page to the other. ViewData and View bag can be threat in the same group because they are both the same thing. The ViewBag is an object that use ViewData. The main difference is that it’s possible to access the values from dynamic properties instead of accessing from an array with a string...
Filed in: ASP.MVC
It’s possible with .Net to write data into Excel’s cells. This can be done by using the library of Microsoft.Office. The first step is to add a reference into you project by right clicking on the References folder and add the COM of Microsoft Office Excel. Here is a small example that show you how to open an Excel worksheet and add value...
Filed in: C#
In some situation, you may need to know if the mouse has hit a specific polygon drawn in a canvas. This can be easily done with Silverlight using the VisualTreeHelper. First of all, you need to have a listener to the mouse even. void myCanvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { e.Handled = true; Point currentMousePosition...
Filed in: Silverlight
Sometime, Xml can be stored in column of a table. I personally try to avoid, especially when it has XSD (Xml Schema Definition) that will be validate in the database side instead of the code side. Even more when I’ll need to get specific data into it later on in a query. Still, sometime, you have no choice because the system has been built this...
Filed in: Sql
The event log file is full error This is what I was getting the day I had to install Silverlight 2 on a Visual Studio 2008 software. I have Visual Studio 2010 working with Silverlight 4 but this project is older and required to have a previous version of C# and Silverlight. I got told to install the Silverlight 2 Tool for Visual Studio 2008. This tool...
Filed in: Silverlight
If you came from the world of NUnit you may stomped into the error “Method should be marked static” without any other indication of which method it’s about. With NUnit, you were using TestFixtureSetUp as attribute to a class’ method to get it executed before all test once. With MSTest you have to use the attribute ClassInitialize. So,...
Filed in: C#
When unit testing you can get this kind of error if you try to use a class that use different thread of the main one. At first, I haven’t realized that I were using another thread because I was testing my Shape class. After some minutes, I realized that I were using the System.Windows.Shape and not mine… once the reference set correctly...
Filed in: C#
If you have Resharper, you can see sometime a warning saying that you “Access to modified closure”. If you do not have it, you can still have odd behavior something with the values. In both case, this mean that Linq is accessing a value that might (or not) be modified. Linq execute delegate functions. If you try : var listInteger = new...
Filed in: Linq
Some time it can be useful to dump all data of a table in the format of SQL insert statement. This can be done easily with Microsoft SQL Management Studio. The first step is to right click on the database and select the option Task>Generate Script. This will popup a wizard window. Microsoft Sql Management Studio Generate scripts The last step is to...
Filed in: Sql
Let say that you want to have your application in multiple language. In Asp.Net, the choice is obvious to go with resource file. Since I am coming from the web side, I did the same thing with Silverlight. Visual Studio Resource Editor In Silverlight, you can still use Resource File. They are available in the New Item dialog. How to add a Resource file...
Filed in: Silverlight
wordpress themplates