Tag | Javascript Posts

I was working through some scenarios recently with Azure and Silverlight. I immediately decided a quick walk through for setting up a Silverlight Application running in an ASP.NET MVC 2 Application would be a cool project. This walk through I have Visual Studio 2010, Silverlight 4, and the Azure SDK all installed. If you need to download any of those go get em? now. Launch Visual Studio 2010 and start a new project. Click on the section for cloud templates as shown below. After you name the project, ...

I’ve been working a lot with Microsoft CRM over the past few months and much of the screen level customization uses javascript.

One thing I discovered today while breaking apart some dates was that the javascript getDate() returns the day of the month 1-31 as you would expect but the getMonth() returns 0-11… definitely not what I expected!!

Tonight the Brisbane Alt.NET group is doing a coding dojo. I am hoping to talk someone into pairing with me to solve the kata in CoffeeScript. CoffeeScript is an awesome language, half javascript, half ruby, that compiles to javascript. To assist with tonight’s dojo I wrote the following micro test framework for CoffeeScript: <html> <body> <div> <h2>Test Results:</h2> <p class='results' /> </div> <script src="http://ajax.googleapis... ...
In my previous example we talked about how to fetch data from database and how to populate the form with data using L2S. In this example I’m going to extend a little bit of what I have demonstrated in my previous example. Basically I’m going to show you the basic way on how to edit and delete data from the form and update the database using L2S technology. Since this is a continuation of my previous example so I would suggest you to refer that first before you go any further. STEP 1: Setting up the ...
Someone asked me to compare Silverlight / HTML development. I realized that the question can be answered in many ways: Below is the high level comparison between a HTML /JavaScript client and Silverlight client and why silverlight was chosen over HTML / JavaScript client (based on type of users and major functionalities provided): 1. For end users Browser compatibility Silverlight is a plug-in and requires installation first. However, it does provides consistent look and feel across all browsers. ...
<script type="text/javascript"> $(document).ready( function() { $("input[id$='btnOK']").cli... { $("#form1").validate({ rules: { txtName: { required: true }, txtEmail: { required: true, email: true }, txtPostalAddress: { required: true, maxlength: 50 } }, messages: {}, onsubmit: true }); }); $("input[id$='Button1']").c... { $("#form1").validate({ rules: { txtName: { required: true } }, messages: {}, onsubmit: true }); }); }); </script> ...

use this piece of code, else we suffer....:)

<script src='<%=ResolveUrl("~/_scripts/jquery-1.2.6.min.js" ) %>' type="text/javascript"></script>

Normal 0 false false false EN-US X-NONE HI /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; mso-bidi-font-size:10.0pt; ...
A Good .NET Quiz ... Whilst casually surfing today afternoon I came across a good .NET quiz in one of the indian software company website. It is rather a general technology quiz than just a .NET quiz because it also contains options for the following technologies. .NET PHP Javascript MySql Testing QTP English Aptitude General Knowledge Science HTML CSS All It also has the following levels for the Quiz: Easy Medium Hard All The URL of the quiz is as below: http://www.qualitypointtech... ...
Don’t miss out on the opportunity to learn about the new features in Visual Studio 2010. Check out the MSDN Events page and find out when the talented folks of the Developer & Evangelism group will be visiting your city to prove to you that /*Life Runs On Code*/. I’ll be attending the Raleigh event June 2, 2010 from 1:00 - 5:00 PM. North Carolina State University, Jane S. McKimmon Conference Center 1101 Gorman St Raleigh North Carolina 27606 United States From the Raleigh Event page: Event Overview ...
The Orchard Project is a new OOS Microsoft project that is being developed up on CodePlex. From the Orchard home page on CodePlex, it states “Orchard project is focused on delivering a .NET-based CMS application that will allow users to rapidly create content-driven Websites, and an extensibility framework that will allow developers and customizers to provide additional functionality through modules and themes.” The Orchard Project site contains additional information including documentation and ...
Lately I’ve ran into situations where I had to change elements or had to request a value in the DOM from Silverlight. jLight, which was introduced in an earlier article, can help with that. jQuery offers great ways to change CSS during runtime. Silverlight can access the DOM, but it isn’t as easy as jQuery. All examples shown in this article can be looked at in this online demo. The code can be downloaded here. Part 1: The easy stuff Selecting and changing properties is pretty straight forward. Setting ...
Just getting a few interesting cloud links “down on paper”. I last did one of these on Azure in Feb 20010. Cloud Links: Article on Debugging in the Cloud http://code.msdn.microsoft.... A sample app that demonstrates monitoring and automatically scaling an Azure application in response to dropping performance etc. Basically a console app that checks perf stats and then uses the Service Management API to spin up new instances when needed. Azure In Action book is imminent :) Running Memcached ...
I did it and i am going to explain step by step. The explanatination may appear long but its simple if you follow. Note: All the softwares i have used are the latest and i have packaged them and provided them in the link below. I use Nokia N96 1) RootSign smartComGPS and install it on your phone(i havent provided the signer so that u wuld do some little work. i used Secman' rootsign). 2) Install Universal Maps Downloader, SmartCom OGF2 converter and OziExplorer 3.95.4s on my PC. a) UMD is used to ...
MvcContrib contains a feature called Portable Areas which I’ve recently blogged about. In short, portable areas provide a way to distribute MVC binary components as simple .NET assemblies where the aspx/ascx files are actually compiled into the assembly as embedded resources. This is an extremely cool feature but once you start building robust portable areas, you’ll also want to be able to access other external files like css and javascript. After my recent post suggesting portable areas be expanded ...
I realise that the topic above is likely not the most original but that’s best I could come up with. Apparently it is customary to use the first blog to introduce oneself so that’s what I’m doing here. My name is Anthony Jones, I live in a town called Halesowen part of what is known as the Black Country in England. I currently work for Union Square Software primarily with ASP.NET, C#, JavaScript and sometimes even Silverlight. I have been cutting code for the best part of 30 years (yes I do count ...
Great event : Microsoft Visual Studio 2010 Launch @ Microsoft TechEd Blore I was really excited on attending the day 1 of Microsoft TechEd 2010 in Bangalore. This is the first Teched that am attending. The event was really fun filled with lot of knowledge sharing sessions and lots of goodies and gifts by the partners Initially the Event Started by Murthy's Session. He explained about the Developers relating to the 5 elements of nature (Pancha Boothaas) 1. Fire - Passion 2. Wave (Water) - Catch the ...
Introduction With the recent news about Silverlight on the Windows Phone and all the great Out-Of-Browser features in the upcoming Silverlight 4 you almost forget Silverlight is a browser plugin. It most often runs in a web browser and often as a control. In many cases you need to communicate with the browser to get information about textboxes, events or details about the browser itself. To do this you can use JavaScript from Silverlight. Although Silverlight works the same on every browser, JavaScript ...
This is the third post in a series related to build and deployment considerations as I’ve been exploring MVC Portable Areas: #1 – Using Web Application Project to build portable areas #2 – Conventions for deploying portable area static files #3 – Portable area static files as embedded resources In the last post, I walked through a convention for managing static files. In this post I’ll discuss another approach to manage static files (e.g., images, css, js, etc.). With this approach, you *also* compile ...
This is the second post in a series related to build and deployment considerations as I’ve been exploring MVC Portable Areas: #1 – Using Web Application Project to build portable areas #2 – Conventions for deploying portable area static files #3 – Portable area static files as embedded resources As I’ve been digging more into portable areas, one of the things I’ve liked best is the deployment story which enables my *.aspx, *.ascx pages to be compiled into the assembly as embedded resources rather ...
Sinatra is a Ruby DSL for building web applications. It is distinguished from its peers by its minimalism. Here is hello world in Sinatra: require 'rubygems' require 'sinatra' get '/hi' do "Hello World!" end A haml view is rendered by: def '/' haml :name_of_your_view end Haml is also new to me. It is a ruby-based view engine that uses significant white space to avoid having to close tags. A hello world web page in haml might look like: %html %head %title Hello World %body %div Hello World You see ...
Hace algunos días, jugando con las configuraciones del IIS, revolvíamos las opciones de compresión de contenidos. La intención era habilitar gzip para el contenido estático pero la cosa salió tan mal que el portal, en vez de reducir su tamaño por los contenidos comprimidos, lo "redujo" porque el servidor dejó de enviar los archivos javascript y las hojas de estilo al navegador. Después de estar buscando como hora y media, resultó que la explicación y la solución eran bastante sencillas (y ni siquiera ...
After deciding I wanted to dive full-on into the world of ASP.NET MVC 2, I began doing some research into what would be the best way to support some of my required AJAX functionality on this platform. The result of these efforts was a barrage of options – many of which required completely different JScript infrastructure than what I planned to go forward with. As I’ve been delighted with jQuery so far, I began tossing out all approaches that didn’t natively leverage it… Thus, I planned to resist ...
InvalidOperationException: Cross-thread operation not valid: Control 'progressBar' accessed from a thread other than the thread it was created ... Now this is not a nice way to start a day! not even if it's a Monday! So you have seen this and already thought, come on, this is an old one, just ask whether InvokeRequired before calling the method in the control, something like this: if (progressBar.InvokeRequired) { progressBar.Invoke ( new MethodInvoker( delegate { progressBar.Value = 50; }) ) }else ...
Continuing on my series of builders for C# and Ruby here is the solution in Javascript. This is probably the implementation with which I am least happy. There are several parts that did not seem to fit the language. This time around I didn’t bother with a testing framework, I just append some values to the page with jQuery. Here is the test code: var initialiseBuilder = function() { var builder = builderConstructor(); builder.configure({ 'Person': function() { return {name: 'Liam', age: 26}}, 'Property': ...
Sorry for the rather lengthy post here. I get asked this all the time so I decided to post it…Visual Studio 2010 editions will be available on April 12, 2010. Product Features Professional with MSDN Essentials Professional with MSDN Premium with MSDN Ultimate with MSDN Test Professional with MSDN Debugging and Diagnostics IntelliTrace (Historical Debugger) Static Code Analysis Code Metrics Profiling Debugger Testing Tools Unit Testing Code Coverage Test Impact Analysis Coded UI Test Web Performance ...
When writing tests, other than end-to-end integration tests, we often need to construct test data objects. Of course this can be done using the class’s constructor and manually configuring the object, but to get many objects into a valid state soon becomes a large percentage of the testing effort. After many years of painstakingly creating builders for each of my domain objects I have finally become lazy enough to bother to write a generic, reusable builder class for .NET. To use it you instantiate ...
Please find how we call JavaScript Object Notation in cloud applications. As we all know how client script is useful in web applications in terms of performance. Same we can use JQuery in Asp.net using Cloud computing which will asynchronously pull any messages out of the table(cloud storage) and display them in the browser by invoking a method on a controller that returns JavaScript Object Notation (JSON) in a well-known shape. Syntax : Suppose we want to write a JQuery function which return some ...
Employee Info Starter Kit is a ASP.NET based web application, which includes very simple user requirements, where we can create, read, update and delete (crud) the employee info of a company. Based on just a database table, it explores and solves most of the major problems in web development architectural space. This open source starter kit extensively uses major features available in latest Visual Studio, ASP.NET and Sql Server to make robust, scalable, secured and maintainable web applications ...
MIX day 1’s keynote was all about Windows Phone 7 (WP7). MIX day 2’s was a reminder that Microsoft has much more going on than a new mobile platform. Steven Sinofsky, Scott Guthrie, Doug Purdy and others showed us lots of other good things coming from Microsoft, mostly in the developer stack, that we certainly shouldn’t overlook. These included the forthcoming IE9, its new JavaScript compiling engine and support for HTML 5 that takes full advantage of the local PC resources, including the Graphics ...
Well, day 2 of the MIX10 conference did not disappoint. The keynote speakers introduced the preview release of IE9, which looks really cool and quick, and Visual Studio 2010 RC that is scheduled to RTM on April 12th. It seemed to have a lot of improvements aimed at making developers more productive. Here are the current links to these two offerings: Internet Explorer 9 – Platform Preview Visual Studio 2010 and .NET 4 – Release Candidate While both of these were interesting, the demos that really ...
This post is specific to India Its been a month since I wrote my last post. Much of work has been happening around planning for Tech Ed India, the upcoming Virtual TechDays this week as well as our Developer content at the Great Indian Developer Summit 2010. Its going to be one exciting period starting this week and I am glad I would be able to meet a lot of folks who have written to me personally that they would like to catch up at Tech Ed India. For now, I had a chance to meet the Microsoft India ...
This is a message I posted to the software craftsmanship group, looking for a week-long, pairing / skill sharing opportunity in the USA. I am a journeyman software craftsman, currenlty living and working in Brisbane Australia. In April I am going to travel to the US to attend Alt.Net Seattle and Seattle codecamp. In between the two conferences I have five days in which I would like to undertake a craftsmanship mini-apprenticeship, pairing and skill sharing with your company. I do not require any ...
In the previous post I mentioned about manipulating SharePoint PeoplePicker control using JavaScript, in this post I will show how to validate the InputFormTextBox contol using custom JavaScript function. Here is the nice post by Becky Isserman on why not to use RequiredFieldValdator or InputFormRequiredFieldValid... with InputFormTextbox. function ValidateComments() { //retrieve the text from rich text editor. var text = RTE_GetRichEditTextOnly("&l... rteComments.ClientID %>"); if (text != ...
The following code adds a method to javascript arrays that returns a distinct list of values. Array.prototype.distinct = function() { var derivedArray = []; for (var i = 0; i < this.length; i += 1) { if (!derivedArray.contains(thi... { derivedArray.push(this[i]) } } return derivedArray; }; and to demonstrate: alert([1,1,1,2,2,22,3,4,5,6... This produces 1,2,22,3,4,5,6,7 ...
I was developing custom ASP.NET page for a SharePoint project, and the page uses SharePoint PeoplePicker control. I needed to manipulate the control on the client side based on the user inputs. PeoplePicker Picker is a complex control and the difficult bit is that it contains many controls on the page (use the page source viewer to see the HTML tags generated). So getting into the right bit is tricky and also the default JavaScript functions like, control.disabled; control.focus(); will not work ...
This javascript adds a method to javascript arrays that returns a boolean indicating if the supplied object is an element of the array Array.prototype.contains = function(item) { for (var i = 0; i < this.length; i += 1) { if (this[i] === item) { return true; } } return false; }; To test alert([1,1,1,2,2,22,3,4,5,6... // true alert([1,1,1,2,2,22,3,4,5,6... // false ...
Javascript allows you to declare variables simply by assigning a value to an identify, in the same style as ruby: myVar = "some text"; Good javascript developers know that this is a bad idea because undeclared variables are assigned to the global object, usually window, making myVar globally visible. So the above code is equivalent to: window.myVar = "some text"; What I did not realise is that this applies to for loop initialisation as well. for (i = 0; i < myArray.length; i += 1) { } // is equivalent ...
So I was playing around with NavigationNodeCollection, which is basically like SPNavigationNodeCollection just to make sure it worked without a hitch…Here is a little sample snippet of what should work: Unfortunately, you get a nice little javascript error that does not allow you to access the child nodes. I tried a foreach() loop that gets a NavigationNode for each parent then loops through the NavigationNode.Children that did not work either. I threw in two ExecuteQueryAsync statements thinking ...
1) Turn off Tracing unless until required Tracing is one of the wonderful features which enable us to track the application's trace and the sequences. However, again it is useful only for developers and you can set this to "false" unless you require to monitor the trace logging. How it affects performance: Enabling tracing adds performance overhead and might expose private information, so it should be enabled only while an application is being actively analyzed. Solution: When not needed, tracing ...
Why Use Client-side Javascript Templates? When building rich internet applications you often need to construct html on the client. I am going to demonstrate how to construct DOM elements using the jqote jQuery plugin (2.0.0). The naive approach to client-side html generation is to embed html inside javascript like: var text = 'Some text'; $('body').append($('<div id="content>' + text + '</div>"')); This approach fails as the complexity of the html increases. It is also a clear separation ...
Here are steps on setting up a slideshow on your SharePoint site really fast using a Content Editor WebPart (CEWP), jQuery and a Picture Library. The jQuery for the slide show makes use of the Cycle plug-in located at http://jquery.malsup.com/cy... There are plenty of demos on the site along with instructions on using the API. Here are the steps to implement the slideshow on a SharePoint site: Download the jQuery library and the Cycle plug-in and upload them to a document library Create a picture ...
UPDATE (2011-01-28): ASP.NET MVC 3 I have a newer blog post that shows how to get Client Side Validation Summary without doing any of this. I will still be answering questions and supporting this for developers who are still using ASP.NET MVC 2. If you are on ASP.NET MVC 3, go here. Problem The MicrosoftMvcJQueryValidatio... script file, which integrates with the jQuery Validation Plugin, does NOT populate validation errors inside the Validation Summary control. I will show you how to populate validation ...
Here’s the scenario: I have a form which contains a textbox. This textbox should be populated with a query string value. Users should not be able to edit the value of the textbox while adding the item. Solution: The above can be achieved using a Content Editor Web Part (CEWP) and jQuery. Steps: 1. Append the NewForm.aspx url with the following: &PageView=Shared&To... 2. This will cause the ‘Add Web Part’ tool pane to show up. 3. Add a CEWP to the page. 4. Go the webparts properties ...
Recently I was working on a project that had a large amount of roles that were going to be utilized on many different controllers and even on individual controller actions. Originally it was given to me utilizing the standard out-of-the-box way of Authorizing with MVC 1.0: //MVC’s standard authorize attribute [Authorize(Roles=”Administr... User”)] public class HomeController : BaseController { ... } I was told that role changes may occur in the future. This caused fear of the amount of work that ...
If you need to use JavaScript to do a Check All on all the checkboxes in the column, be sure to use this guy's code: http://www.highoncoding.com... If your code simply change the state (...checked == true), it does not get registered and does not get passed into the code behind. Instead, follow AzamSharp's article and make sure you initiate a click() event ...
I needed to create a web page that let the user assign one item of a grid to a target by dragging the item and dropping it on a row on a different grid. I immediately thought about using JQuery UI draggables and droppables but it didn’t work as expected. After looking for a solution for some time I finally came to this post by David Petersen explaining how to provide a helper element to JQuery to wrap the floating row while dragging and it worked perfectly. source.draggable({ helper: function(event) ...
While my home development computer is fried I’m going to hack away at my backlog of non-code related posts. Today I’d like to discuss some of the advantages and disadvantages of using Microsoft MVC over WebForms. First of all, MVC is not the end all, magical platform that many people would like you to believe. In fact I wouldn’t even recommend it to beginner developers. However, if you have experience with .NET and you’re willing to put in the time to learn how MVC works, you will find that it offers ...
So you want to read a string (say, from a file or just passed in as a variable) into a .NET class. Here's a quick example of how to do this. Let's start with our sample JSON: {"FirstName":"Joe","LastNam... So to keep this simple, let's say we want to populate a class with this data. our class: public class Person { private string _FirstName; private string _LastName; private string _MiddleName; public string FirstName { get { return this._FirstName; } set { this._FirstName= ...

A couple of people have asked me recently where the whitepaper is... its here:

http://go.microsoft.com/fwlink/?LinkId=183500