Posts

Donate

StringCollections In C#.NET

After some tiresome work, i decided to visit MSDN. Along the way,i manage to take a grip from System.Collections.Specialized StringCollection class. I was used to List , ArrayList, and etc. After reading MSDN's documentation,I managed to create a simple example. class Program { static void Main( string [] args) { //defined class StringCollections collections = new StringCollections(); //.NET collection class StringCollection netcollection = new StringCollection(); string [] names = new string [5]; //insert five elements for ( int i = 0; i <5; i++) { names[i] = "nelson" + (i+1); } //store to stringcollection object netcollection = collections.Employees(names); //navigate collection class StringEnumerator enumerator = netcollection.GetEnumerator(); while (enumerator.MoveNext()) {

ASP.NET MVC View Model

I recently read an article from Stephen Walther on View Models and gave it a spin. In this example,i created two typed class namely People and address..You may create properties or public fields in there. After that,create a controller with the view model which has List properties. Then in your view,you simply inherit the PersonViewModel. Below is the Person Controller with the PersonViewModel. public class PersonController : Controller { public ActionResult Index() { // Create list of People var people = new List<People>(); people.Add( new People(30, "Nelson G." )); people.Add( new People(28, "James Ingram" )); // Create list of Address var address = new List<Address>(); address.Add( new Address(9000, "Cebu" )); address.Add( new Address(6521, "Baybay" )); // Return view return View( new PersonVi

Accessing HttpUtility Class In C# Winforms

To use or access the HttpUtility class in C# winforms, do the following: 1. Add reference to System.Web dll 2. Use any methods available in HttpUtility class. System.Web.HttpUtility.HtmlDecode(mystring); System.Web.HttpUtility.UrlDecode(mystring); Cheers!

Using Sessions In ASP.NET Web Forms Web Services

Lately, i was confronted with a problem on managing state with web services, after reading a book on XML in .NET 2.0, i found a tip on creating and consuming web services with state capabilities. I followed this link: Using Session State in a Webservice MSDN: Web Service Session This idea, is a life saver to some of my web projects.. :D

Visual C# 2010 Express (System.Web Namespace Not Found)

When you created a winforms project and you would like to use HttpUtilities or other classes found on System.Web, you might notice that when you tried adding reference to System.Web, it is not found on the .NET Tab. By default, the project is targeted on .NET Compact framework 4.0, so just change it to .NET Framework 4.0. By then,you will be able to add the System.Web namespace in your projects. Cheers

Repair A SQL Server 2008 Suspect Database After Upgrading

Lately, I've installed SQL Server 2008 Developer Edition in my pc and migrated all sql server 2005 databases. Upon attaching/restoring all databases, some were marked as suspect. Below is the sql script to repair those databases. EXEC sp_resetstatus 'Test' ; ALTER DATABASE Test SET EMERGENCY DBCC checkdb( 'Test' ) ALTER DATABASE Test SET SINGLE_USER WITH ROLLBACK IMMEDIATE DBCC CheckDB ( 'Test' , REPAIR_ALLOW_DATA_LOSS) ALTER DATABASE Test SET MULTI_USER But as a precautionary measure,I have back-up plans for each database,as to have another copy when things go wrong. Test is the database name. Source: how-to-repair-sql-server-2008-suspect

Deploying ASP.NET Web Forms Websites Using ASP.NET Membership Framework

In my case, i have been experimenting an e-commerce application which uses asp.net membership framework. If I run the website using visual studio 2008, it successfully logs in using the users i have created using the built-in asp.net website administration tool. However, if you deploy this on a production server such as IIS, you cant' log-in. The solution is straightforward in this link: Always set the "applicationName" property when configuring ASP.NET 2.0 Membership and other Providers(Configuring ASP.NET 2.0 Membership)

How To Clear Sessions After Logout Button Is Clicked In ASP.NET Web Forms

Solution I found is on this link: ASP.NET Forum Link

How To Install IIS On Windows 7 Home Premium

Here's the link: Technet Link

Unable To Open EDMX (Entity Framework in Design View) After Closing

Scenario: You may have recently added an entity framework that maps to an sql server table. After that, you suddenly close it. But when you tried to double click the Entity model, it does not open in the design view. Solution: Cannot Open .edmx file in the designer

Donate