Posts

Donate

JQuery Calculator Example In ASP.NET Web Forms

Image
The image above is a jquery/javascript calculator developed in ASP.NET 4.0 web template. Here's the functions. I'wont be posting all codes since it will took up space in my post. I'll just post the sqrt() and a number scripts. The ASPX markup uses plain css for centering and aligning the buttons and html controls. No asp.net server controls are involved. For the jquery processing, im using the id selector. /* show zero to textbox on page load */ $( "#txtCalc" ).ready( function () { $( "#txtCalc" ).val( "0" ); }); //square root $( "#btnSqrt" ).click( function () { var text = $( "#txtCalc" ).val(); //if invalid input,do not execute codes below if (text.search( "Invalid" ) != -1) { return ; } if (text.length == 1) { if (text == "0" ) { return ; }

Random Class In C#.NET Not Generating Proper X And Y Coordinates

I am creating a snippet to change x and y coordinates upon runtime. However,not as i expected,the generated random numbers does not meet my requirements. Here is the C# snippet: switch (odd_eve) { case 0: Random rand = new Random(); count = rand.Next(0, 300); break ; case 1: Random rand1 = new Random(); count = rand1.Next(310, 600); break ; default : } Based from the code above,the random generates a slanting x and y coordinates. The solution i come up came from the idea of a fellow developer to declare one Random object in one class. Random rand = new Random(); //declared as global variable //function snippet switch (odd_eve) { case 0: count = rand.Next(0, 300); break ; case 1: count = rand.Next(310, 600); break ; default : } Works like a charm!!!

How To Debug JavaScript Code In Visual Studio 2008 Or Visual Studio 2010

Here are the simple steps to debug js code in your aspx markup. 1. Open Visual Studio 2008/2010 2. Click Tools then options 3. Expand debugging node then click checkboxes Manages,Native,Script. 4. In your web.config file,make sure to set compilation debug to true. <compilation debug= "true" > <assemblies> <add assembly= "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly= "System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly= "System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly= "System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> </assemblies> </compilation> 5. Choo

Microsoft SQL Server, Error 14234

Lately, I installed an SQL Server 2005 database on my clients server machine,and when i created a database maintenance plan,i got the error as stated: The specified '@subsystem' is invalid (valid values are returned by sp_enum_sqlagent_subsystems). (Microsoft SQL Server, Error 14234) The solution is to install SQL Server 2005 Integration Services.

"Installation Incomplete - The installer was interrupted before could be installed. (Visual Studio Web Setup Project)

Hello! Recently, the ASP.NET Web Forms software i maintained crashed down and can't be opened by the browsers (IE,Firefox and chrome). I tried different kinds of solutions but they don't work. So,i tried the steps below to re-install the web setup package with the error provided as the title of the post. Culprit: virus attack[dangerous or high risk worm/trojan] Solution: 1. Repair windows xp sp2 (using installer cd) XP Repair Install Note: I performed only steps 1-6 2. After repairing, I uninstalled the IIS 3. Delete the current Inetpub folder in Drive C:\ [make sure to backup any files in the Inetpub folder] 4. Then restart PC after performing steps 2-3 5. Re-install IIS using windows xp sp2 cd 6. Register asp.net 2.0 from command prompt c:\windows\microsoft.net\framework\v2.0.50727>aspnet_regiis -i 7. Restart PC/Server 8. Continue Installing VS Web Setup Project Note: This may also apply to Windows 2003 server or new Windows OS.

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

Donate