Monday, January 19, 2015
Visual Studio Tips & Tricks–10 : How to Change the color theme in Visual Studio 2015?
Sunday, January 18, 2015
Visual Studio Tips & Tricks – 9 : How to Change the menu to text to “title case” in Visual Studio 2015?
Sunday, December 21, 2014
An easy way to construct the Connection String in ASP.Net
Connection strings are necessary when you want to interact with any databases like SQL Server, MSAccess etc. Most probably if you are using ADO.Net Concepts to interact with Database then you can aware about the connection string. In this article I am going to share how it can be easily constructed.
Step 1:
Open Visual Studio and create sample web form application.
Step 2:
Switch over to “Design Mode” and in the tool box, just drag and drop a “Gridview” control in to the web form.
Step 3:
Select “New Data Source”.
Step 4:
In the “Data Source Configuration Wizard”, select your database click “OK”.
Step 5:
In the next step of the wizard, Click “New Connection”.
Step 6:
It will provide a pop-up dialog box to select “Data Source”, in that select “Data Source” and select data provider from “Data Provider” dropdown list, then click “Continue”.
Step 7:
In “Add Connection” modal dialog, select your “Server Name” (if not available, first click “Refresh” button, still it not available type your “SQL Server Name” manually on it).
You can either use, “Windows Authentication” or “SQL Server Authentication” to login to your SQL Server.
As a next step, select your database, that is available on your SQL Server. Finally, click “Test Connection”, to check whether the connection is established successfully or not.
Step 8:
As a final step, you will get the Connection string, which can be used on your web/windows application to connect the DB.
Happy Coding!
Saturday, December 20, 2014
ASP.Net MVC – Create Custom HTML Helpers
Step 1:
Create a static class and add method to it like below.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MVCTutorial { public static class CustomHTMLHelper { public static MvcHtmlString ImageLink(string action, string controller, string imgageURL) { // Create a link with an image return MvcHtmlString.Create(String.Format("<a href=\"{1}\\{0}\"> <img src=\"{2}\" /></a>", action, controller, imgageURL)); } } }
Step 2:
Access the custom helper class in a View.
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Sample</title> </head> <body> <div> @CustomHTMLHelper.ImageLink("Home","Account","your image url") </div> </body> </html>
The helper class is static, since it can be called in a easy manner also handy.
Happy coding!
Tuesday, December 9, 2014
Design Pattern - An Introduction
Few weeks ago, I commit to take an session about design pattern in my organization. As a matter of fact, I’m not a big fan of design pattern. However, I began dwell with design pattern, I found interesting on it. So I decided to write some posts on it. In this post, I just give an introduction about design pattern.
So what is design pattern?
Design Pattern are conceived by the 4 people who wrote the book "Design Patterns: Elements of Reusable Object-Oriented Software ". Design pattern is a proven ways to solve the particular problem while arising often writing software programs. Those problems are frequently encountered by the programmers, most probably when design the software. So there is no reinvent the well again. There are 23 solutions predefined by the above authors. Each problem has its own name also.
The ultimate goal:
There is no reinvent of solution for the 23 problems. Also the main benefit is maintainability of software. If you want to change something in the existing system it is so easy. The above are the main benefits of design pattern. These 23 design patterns are called Gang Of Four in general.
They are categorized into 3 types. They are: 1. Structural Pattern 2. Creational Pattern 3. Behavioral Patterns
The category name itself enough to explain, the purpose of each pattern. For example, Creational patterns are talk about the object creation. At the same time structural pattern described about code structure. Below are the 23 design patterns.
Creational Patterns:
- Abstract Factory
- Singleton Pattern
- Builder Pattern
- Factory Method Pattern
- Prototype Pattern
Structural Patterns:
- Flyweight Pattern
- Proxy Pattern
- Adapter Pattern
- Bridge Pattern
- Facade Pattern
- Composite Pattern
- Decorator Pattern
- Behavioral Patterns:
- Chain of Responsibility
- Observer Pattern
- Command Pattern
- Interpreter Pattern
- Iterator Pattern
- Visitor Pattern
- Template Pattern
- Strategy Pattern
- Memento Pattern
- Mediator Pattern
- State Pattern
- Learn By Experience: SMS Gateways
- ASP.Net Forums - FAQ #2 : ASP.Net Project Ideas
- ASP.Net Forums – FAQ #1 : How to enable Adsense in my site?
- Main components of .Net Framework
- ASP.Net Forums–FAQ #6: ASP.Net Session Expired Problem
- How to Send SMS From ASP.Net Web Application?
- Visual Studio Tips & Tricks: 2 – Create Virtual Directory Problem
- Visual Studio Tips & Tricks–10 : How to Change the color theme in Visual Studio 2015?
- CRUD Operation - ASP.Net MVC with ADO.Net
- .Net Architecture