Tag | Javascript Posts

So if you are in my situation, where you have a project using prototype and you want to use the jQuery date picker, you will notice that in certain situations, depending where your javascript is defined, you pickers won't work. The problem is the jQuery and Prototype $. You need to redefine the jQuery $ with anoter literal, like $j. So try this: <script type="text/javascript" charset="utf-8"> var $j = jQuery.noConflict(); $j(function() { $j('.date-pick') .datePicker({ createButton: false }) ...
I have been a developer for over 10 years, and at one point or another completely relied on the knowledge of someone with more experience than I had to make something work. I figure that it's time for me to start giving back. As background, I am a Microsoft technology based developer currently working in WCF/WPF/XAML, although I have only been doing this type of development for a little while now. I have a solid background that covers ASP.Net (C#/VB.Net), Traditional ASP, Javascript, custom AJAX ...
MOSS doesn't offer this out the box and of course many people would like to have it. Here's a quick and dirty javascript change which will offer this functionality. You'll have to forgive any inelegance in my coding, I'm a bit rusty ;) You need to edit the search.js file and add the following: A trim function function trim(s) { var l=0; var r=s.length -1; while(l < s.length && s.substr(l,1) == ' ') { l++; } while(r > l && s.substr(r,1) == ' ') { r-=1; } return s.substring(l, ...
If mathematics teaches us anything, it’s that there are usually multiple solutions for one problem. When you need to add a reference to a JavaScript or CSS file for a .Net web application (such as SharePoint) from the code behind you have many options available to you. Below are two SharePoint specific methods that you can use to reference a JavaScript and CSS file from within a web part (or any other custom code solution.) Registering Javascript The first example registers an external JavaScript ...
Lets quickly have a look at how you can limit the entry to textbox and display the character input left to be keyed in. First things first, the script. <script type="text/javascript"> $(function() { var limit = 250; $('#dvLimit').text('250 characters left'); $('textarea[id$=txtDemoLimi... { var len = $(this).val().length; if (len > limit) { this.value = this.value.substring(0, limit); } $("#dvLimit").text(limit - len + " characters left"); }); }); </script> The $() ...
Was doing my daily research today and learned a couple of new and interesting things. A while back, I wrote a post about rendering options using .NET 3.5 SP1's charting component. I outlined a few of the more conventional/out-of-the-box methods (temporary directory, binary streaming). I also outlined a lesser-known technique in which you stream binary data to the src attribute of your <img> tag. That ends up looking like this... <img src='data:image/png;base64, iVBORw0KGgoAAAA[snip]; /> ...
c# 4.0 Part 1 The following are some of the new features and few interesting things you can do with c# 4.0. - Named and Optional Parameters - ExpandoObject - Interface with Python (and example) Program 1 class Program { // Optional parameters should be at the end static void PrintMessage(string name = "World", string greeting = "Hello") { Console.WriteLine("{0} {1}", greeting, name); } static void Main (string[] args) { PrintMessage("World", "Hello"); // prints "Hello World" PrintMessage(greeting:"Good... ...
Welcome back. This time we will look at creating a simple jquery pager plugin to use with asp.net mvc project. Please note the intent is to learn the basics of jquery plugin development. The control as such is not recommended for use in production environment. I recommend having a look at the jQuery Authoring Guideline at docs.jquery.com/Plugins/Aut... Let's begin our journey into the mystery of jquery plugin. The first step is to create a self executing anonymous function. Anonymous functions ...
Javascript does not have classes in the traditional sense, but we can achieve something similar in a number of ways. C# and Ruby both have standard class syntax. This post is part of a series comparing the language features of the C#, Javascript and Ruby programming languages. Part 1: Installation and hello world Part 2: Variables Part 3: Classes C# public class Vehicle { protected string Make { get; private set; } protected string Model { get; private set; } public Vehicle(string make, string model) ...
Let's try a simple in-place edit with jquery. For demonstration purpose I am using the plain old HTML file. However, if you, wish you could apply the same technique to asp.net, asp.net mvc or php or any other web application as well. Here is the html that we will be using for the demo. <body> <div style="line-height:3xm;back... Double Click the below paragraph to edit. </div> </br></br> <div class="edit"> Lorem ipsum dolor sit amet, consectetur ...
This edition of blog tip shows you how to focus a text input on a page to the desired element. Use jsbin.com for executing/troubleshooting or just for learning jquery or any other popular js framework that it supports. I'll show two ways to do this based on the scenarios you encounter. Using jQuery $(selector).focus method when the DOM is ready: // When the HTML DOM is ready $(function() { $("#elementId").focus(); }); The above works in most cases but may be annoying in situations you have a slow ...
This post is a follow-up on my series about validating business objects throughout different layers of a software system - domain, persistence, and (ASP.NET MVC) GUI. It demonstrates how a self-written validation can be incorporated into a web page (using a bit of JavaScript) and how this can be mapped to a custom validation on the domain side. A short recap In the first part of the above mentioned series, we developed a simple, custom validation aspect that checks if a value really is a member of ...
One of the members in the forum (forums.asp.net) is asking how to limit the number of selected items in the ListBox and so contributors (including me) gave the OP (Original Poster) different ideas on how to validate it. Some of them provided solution using pure JavaScripts and a mixture of code behind and JavaScript. However the OP doesn’t want to use JavaScript validation for some reason, so I decided to post the solution that I have provided on that thread as a reference to others. Here it is: ...
For those of you who missed the chat today, here is the raw transcript. By raw, I mean that I copied and pasted the discussion without any edits. This is divided into two parts, the top part is the answers from the Microsoft Experts and the bottom part is the questions from the audience. Answers from Microsoft: msft_davbo (Moderator): Our chat today covers the topic of Windows Embedded CE! 1. This chat will last for one hour. During this hour, our Experts will respond to as many questions as they ...
This post is part of a series comparing the language features of the C#, Javascript and Ruby programming languages. Part 1: Installation and hello world Part 2: Variables Part 3: Classes Variables C# requires that variables be declared with a specific type. Javascript and Ruby determine the type of variables at runtime. Here is the syntax: C# public string publicMessage = "Hello World"; private string privateMessage = "Hello World"; static string PRIVATE_MESSAGE = "Hello World"; Javascript var message ...
I’m going to be looking at a few different languages and blogging my thoughts. I am not a language dork so it will probably be mostly wrong. The languages I care about are c# (which is what I mostly use), javascript (which I love) and ruby (which everyone else loves). This post is part of a series comparing the language features of the C#, Javascript and Ruby programming languages. Part 1: Installation and hello world Part 2: Variables Part 3: Classes Installation C# is installed by installing visual ...
This series of posts discusses the use of an Aspect-oriented programming approach for implementing the validation part of a business domain, using the ValidationAspects aspect library, that sits on top of the PostSharp aspect weaver and allows for placing Design by Contract - style attributes on properties and method arguments, as well as for easy runtime validation of an object's state. This is the third post of a three-part series that discusses the use of these validation aspects throughout the ...
I own a company, Tiger Computer Services Ltd, which is an Independent Software Vendor (ISV) providing .NET software solutions to clients in the London area. One of the most significant considerations when running a small ISV is the cost of supporting software in the field. For some clients, support is not a billable item, especially if the fault is within the software we have provided. This means that every time the telephone rings, we bleed money, and if we have to actually go on site to resolve ...
Let's face it, it needed a rename. Mitch.Web just lacks everything in terms of marketing, so I've re-branded my (currently error logging :P) framework to "The Evil Little Developer's Toolbox" in game with my EvilDev theme. I've also made advancements (not guaranteed to work yet) on my error logging framework, mostly in terms of a new Services Project, and the Logging Service. The logging service, is a WCF Service, designed to log errors to a database. The idea behind it, well, I generally focus my ...
Silverlight has come to an age from WPF/E days and today 4.0 version was launched. Features includes: Support for enterprise applications: Printing support: Silverlight application can print itself, how the content is formatted when printed, and determine the content that will appear. It even has capabilities to print a portion of the Silverlight content. RichTextArea control / WebBrowser Control: The RichTextArea has Bi-Di support, allows hyperlinks, XAML content, and embedding of images. It also ...
A new system programming language was recently released by Google and it goes by the name of "Go". According to Google, Go is still in experimental stage and it is an attempt to combine the ease of programming of an interpreted, dynamically typed language (such as Python and javascript) with the efficiency and safety of a statically typed, compiled language like C++. Go is mostly in the C family (basic syntax), with significant input from the Pascal/Modula/Oberon family (declarations, packages), ...
http://dotnetradio.com/arch... Andrew sits down with Atif Aziz. Atif Aziz is a senior IT business analyst at Cargill International and an ex-Microsoftie. His primary focus is helping customers move to the .NET Framework. He speaks regularly at Microsoft conferences and can be reached through his web site. You can find out more about Atif Aziz by visiting his web site www.raboof.com. Raboof.com = FooBar!! Atif describes to us what ELMAH is and the history behind it. He then ...
Google has open sourced their internal JavaScript library under the name Closure. You can download the library using any svn client by pointing to http://closure-library.goog... and getting everything locally into a closure-library-read-only folder. All your custom html/js can then reside next to this folder. To use the framework you have to load the base.js into your document. <script src="closure-library-read-o... Additionally you can import specific ...
I've been very frustrated with the lack of flexibility with wordpress.com hosted blogs, so I am yet again moving. This time I wanted to host my own instance of Subtext but discovered that geekswithblogs.net uses Subtext and figured I would give one last attempt to a hosted community online :) I guess I just don't want to deal with running my own server just for a blog. The most important thing I wanted back was Syntaxhighlighter which was about impossible to use with wordpress.com without paying ...
A great VIDEO series on all the nice effects (and functionality) you can achieve with jQuery JavaScript library for those who know NOTHING about it. jQuery is a very powerful library. One of the first things I do when creating new project is to include the library in it. Microsoft is going to include it by default in ASP.NET web projects (All ASP.Net projects, not just MVC) starting Visual Studio 2010. Here are some few examples of what you can do with it (VIDEO): http://net.tutsplus.com/art... ...
Before I start to explain the topic of this post I should confess one of my many defects: I'm very lazy. Someone may have noticed that from the update rate of this blog, but I really like to avoid as much work as I can. I also really like to experiment new technologies and embedded devices, and that's bad for a lazy guy because that means having to write some code... While experimenting with Silverlight for Windows Embedded I found myself trying to write some more complex samples to continue my own ...
Microsoft has released a new Facebook SDK Version 3.0 (other than their old not-so-great one) and it looks to have not just updated APIs but also wide range of features supported in many application types. Quoting a related blog post from c|net “The web services report” blog: http://news.cnet.com/8301-1... Microsoft on Monday released a software development kit for Facebook that allows developers to create Facebook applications for Silverlight and Windows Presentation Foundation. ...
I thought twice before actually posting this. It was mostly because, of a guilt, that I might be recommending a wrong way of doing things. But then I did realize, that, even if it seems to wrong, it does provide some benefits. Anything that is beneficial, is not necessarily wrong. The problem at hand is, we want to enable ASMX style Authentication in WCF. Its not that WCF does not do a good job when it comes to Security, but because people are more inclined to send the credentials in clear text. ...
This tutorial is based on a short demo/talk I gave at the Columbus .NET Developers Group (CONDG) on IronRuby. It’s mostly designed for the .NET professional and making no assumptions of prior Ruby experience. In Part 1 we get everything installed. In Part 2 we take IronRuby for a test drive In Part 3 we use it to integrate with Cucumber. Installing IronRuby Before we get started, my instructions are more or less the same as this: http://wiki.github.com/asla... … but ...
I am currently studying some of the listed articles which may be of useful for you guys Study material on Object Persistence (This is in Java but subject is general) New things in .Net 4 Beta 2 Javascript Class browser Making jQuery calls to WCF/ASMX with a ServiceProxy Client Disable button during postback Hope they will be of great use. Thanks, Thanigainathan.S ...
This is part 2 of my series on the jQuery UI Dialog. Part 1 – The Default Dialog covered the most basic usage of the dialog widget. In this second part I will demonstrate a simple modal dialog. A modal dialog is a dialog that takes focus, and disables the rest of the application until it is closed. They are used to force the user to acknowledge something, or to gather some input. It is worth pointing out that modal dialogs can be annoying for users so you should consider carefully if it is absolutely ...
Today I was trying to call ASP.Net web service from JQuery. I thought it was easy first. But when tried implementing them I felt the difficulty. I don't had this problem while calling Ajax enabled WCF service from JQuery. Hence I did a small Bing and found out some useful tips to share. I referred links below. http://www.mikesdotnetting.... http://www.dotnetcurry.com/... http://encosia.com/2008/03/... ...
[Source: http://geekswithblogs.net/E... We had a fiddly issue with date validation in an ASP.NET MVC page failing for a valid date in Chrome, but passing in Firefox, IE etc. Tracing through our own code and xVal, the issue was narrowed down to the jQuery validation plugin (jquery.validate.js). For simple date validation, the library instantiates a date object from the given text value and lets JavaScript raise errors for invalid dates: date: function(value, element) { return this.optional(element) ...
This series is going to document increasingly complex usages of the jQuery UI Dialog widget. This first part of the series will demonstrate how to display the default dialog. Other series members: jQuery UI Dialog: Part 2 – The Modal Dialog The jQuery UI Dialog is a powerful client-side dialog control. It is bundled as part of the jQuery UI suite and as such it is available on the Google CDN. Some of its more interesting features are: Modal / non-modal dialogs Support for resizing and dragging Support ...
For those of you who missed the chat today, here is the raw transcript. By raw, I mean that I copied and pasted the discussion without any edits. This is divided into two parts, the top part is the answers from the Microsoft Experts and the bottom part is the discuss (questions) from the audience. Answers from Microsoft: KarelD_MSFT (Expert)[2009-10-27 11:58]: Karel Danihelka - Developer in Partner Response Team. davbo_msft (Moderator)[2009-10-27 11:59]: Our chat today covers the topic of Windows ...
to download the source code please click here The <iframe> tag defines an inline frame that contains another document and is supported in all major browsers. The <iframe> can be placed anywhere in the document flow. The iframe properties such as height and width can be easily modified by CSS and JavaScript. Data can be passed back and forth between the parent container and iframe using Javasrcipt. The document that is displayed inside an iframe can access the main window by the parent ...
XMLHttpRequest (XHR) is a DOM API that can be used inside a web browser scripting language, such as JavaScript, to send an HTTP or an HTTPS request directly to a web server and load the server response data directly back into the scripting language. The technique that we are going to discuss here takes advantage of XMLHttpRequest objects readyState == 3 status (Interactive – Downloading) and responseText property to perform DOM manipulation in a browser. Here is how it works A request is initiated ...
It is quite common to display a loader-image or some kind of progress bar image in a browser when the server is busy serving the request. Before we go deep into page streaming techniques with XMLHTTPRequest call and IFrame, lets look into a simple loader icon implementation – the idea is to display “loading” image until the task completes, display the response in the browser when task ends and hide the loader image. to download the source code please click here Invoke a long task and display loader ...
Here in this series of post I am discussing few techniques to give client instant feedback on task progress in ASP.NET page. In the previous post I have discussed about displaying task progress - using regular handler, here I will discuss how to do the same in standard asp.net page. to download the source code please click here Display task progress – in standard asp.net page In this technique we write some regular ASP.NET script in the page itself, that performs streaming to the original page response ...
So this error stopped my productivity for a good three hours today. Gotta love when that happens. I’m sure there are many different ways to resolve this issue, but I didn’t see anyone with the same problem I was having, so I’m going to go ahead and post my experience and how I fixed it. Background Info: I have a page layout I needed to implement and it uses some rounded corners javascript. My web application uses a masterpage, which I keep in a folder at “~/Resources/MasterPages/”. I’m using themes, ...
1)To ensure debugging of Javascript with VS2008 IDE, you have to make some changes in Internet Explorer. In IE, Go to Tools--->Internet Options. Then in the Advanced Tab, make sure both the following check boxes are unchecked. i) Disable script debugging (Internet Explorer) ii) Disable script debugging (Other).2) Enabling Json on WCF.While enabling a WCF Operation to return data in Json format, you will find that , the tag WebInvoke is not resolved by default namespace references. To take advantage ...
Javascript Intellisense I read this interesting artilce when trying to enable intellisense for my Javascript file. Don miss this as its very useful. Its similar to what we do for VB or C# for intellisense i.e XML documentation. Same concept applies for JavaScript also. This will work in Visual Studio 2008 as there is an enahncement for this. Thanks, Thani ...

Here is a snippet that will check if a JavaScript function exists before executing the JavaScript function.

if(typeof RefreshProducts == 'function')
{   
        RefreshProducts();   
}
Imagine some newbie or junior web developer walks up to you and says, “What tools would you suggest I use to become a better web developer?” Assuming they’re already using either Visual Studio or Web Developer Express, what utilities or resources do you find indispensible for working with ASP.NET or just web development in general? Maybe you have a favorite online resource site that you recommend, Stack Overflow for example, or maybe you have a favorite utility like Chris Pederick’s Web Developer ...
This example shows how to hide a Div when clicking anywhere the page: <html xmlns="http://www.w3.org/19... <head runat="server"> <title>Untitled Page</title> <script type=”text/javascript”> function HideDiv(){ document.getElementById("Co... = 'none'; return false; } function ShowDiv(e){ document.getElementById("Co... = 'block'; if(!e){ e=window.event; } e.cancelBubble=true; return false; } </script> </head> ...
I can't believe how long this took to figure out, I think I read every WCF tutorial out there, and now I look at it it's so mind bogglingly simple I don't know what I wasted my time doing! All I wanted was a WCF service that would accept a POST from jQuery with some JSON parameters and return some HTML, but it seems I repeatedly cocked up the JSON string format and the attributes for the contract. Anyway, here's a simple example so you don't have to endure my frustration. I used .NET 4.0 because ...
If you’re a web developer using Microsoft technologies then, unless you’ve been hiding under a rock somewhere, you’ve probably heard of ASP.NET MVC. If you’re not sure what it is, how it works, or why you would want to consider using it, you’ll find three videos on the ASP.NET MVC page that will answer most, if not all, of your questions. Video #1, titled “Why Use ASP.NET MVC?”, is a 3 minute video which provides a high-level overview of ASP.NET MVC for decision-makers. I especially like the motor ...
This whole IE6 mess starts out with PNGs. I'm not much of an image editor, (okay, fine. I can't crop a picture in photoshop to save my life.) but I do know that PNGs are pretty sweet. Basically they allow varying degrees of transperancy, and really, who can say no to that? IE6 can! One of our clients decided that they wanted a gradient in the header of their site. No problemo, we'll just whip up a gradient image and stick it in the background. That was easy enough, but oh wait there's a bit of an ...
What is something that is longer than a magazine article and shorter than a book chapter? Give up? It's a Wrox-Blox that Wiley has available online with some going for less than $10.00. Written by the best programmers in the their fields, Wrox Blox are short informational pieces and code that will help get you up-to-speed and keep you up-to-date. Build the knowledge you need quickly on a wide variety of topics. In the DotNetNuke world, there are several of these available for you to review and stay ...
Twitter can be a very useful source for data aggregation on any particular topic. Am building an application that will search twitter using their API and then display the results using jQuery. There are 2 ways of accomplishing something like this. We can either do the processing at the server and then populate the page or talk to Twitters REST based api directly from the client. Methods to retrieve data from the Twitter API require a GET request. Methods that submit, change, or destroy data require ...