Resize image while uploading image

Namespace required: using System.IO; using System.Drawing; using System.Drawing.Drawing2D; — .cs page coding on Save button—————– // Create a new bitmap which will hold the previous resized bitmap Bitmap newBMP = new Bitmap(originalBMP, newWidth, newHeight); // Create a graphic based on the new bitmap Graphics oGraphics = Graphics.FromImage(newBMP); // Set the properties for the new graphic …

Build an EntityConnection Connection String (edmx) model connectionstring

Change edmx model connectionstring dynamically in class library (Data Access Layer) // Specify the provider name, server and database. string providerName = “System.Data.SqlClient”; string serverName = “.”; string databaseName = “AdventureWorks”; // Initialize the connection string builder for the // underlying provider. SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder(); // Set the properties for the data source. …

clear previous history in every textbox

Its a problem recently I am facing in my recent project. So my client told me you should clear previous history in every textbox. So I just write a textbox properties in Page_Prerender event in my page(codebehind). protected void Page_PreRender(Object sender, EventArgs e) { txtPassword.Attributes.Add(“autocomplete”, “off”) txtConfirmPassword.Attributes.Add(“autocomplete”, “off”); } It will solve your problem.

Service Unavailable

IIS 6.0 supports both the 32-bit mode and the 64-bit mode. However IIS 6.0 does not support running both modes at the same time on a 64-bit version of Windows. ASP.NET 1.1 runs only in 32-bit mode. ASP.NET 2.0 runs in 32-bit mode or in 64-bit mode. Therefore, if you want to run ASP.NET 1.1 …

JSON ASP.NET Web Services with jQuery

using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Web.Script.Services; using System.Collections.Generic; using System.Linq; public class Employee { public string firstname; public string lastname; public int age; } /// /// Summary description for Employeeservice /// [WebService(Namespace = “http://tempuri.org/”)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ScriptService] public class Employeeservice : WebService { List Employees = new List{ new Employee{firstname=”Aamir”,lastname=”Hasan”,age=20}, …

JSON ASP.NET Web Services with JavaScript

——————————————WebForm1.aspx—————————————— // This function calls the Web service method // passing simple type parameters and the // callback function function CallWebMethod() { // debugger; var User_Name = document.getElementById(”).value; checkDuplicateUserName.WebService1.CheckDuplicate(User_Name, OnSucceeded, OnError); } // This is the callback function invoked if the Web service // succeeded function OnSucceeded(result) { var rsltElement = document.getElementById(“lblDuplicate”); rsltElement.innerHTML = “”; …

Recursive in C#

public partial class _Default : System.Web.UI.Page { List lst = new List(); int mainnode = 0; protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) RadTreeView1.Nodes.Insert(0, new RadTreeNode(“Table of Content”)); } protected void Button1_Click(object sender, EventArgs e) { updatemainnode(); lst.Add(“end”); gv1.DataSource = lst; gv1.DataBind(); } public void updatemainnode() { for (int i = 0; i 0) …

Implement Logger in asp.net

First of create LoggingConstant.cs File in that Declare all Pages name as variable without extension. For ex. public enum ModuleToLog { default, login } public enum LogType { DEBUG, EXCEPTION, INFO } After that create Logger.cs File.. public class Logger { public static void Write(LogType eLogType, ModuleToLog eModule, string strMethodName, string LogMessage, string strUserId) { …