Tag | Javascript Posts

1. Set EnableScriptGlobalization=true on the script manager <asp:ScriptManager runat="server" EnableScriptGlobalization="... /> 2. Use the Sys.CultureInfo.CurrentCulture command either inside the alert or through Firebug console to check the CultureInfo at the client side 3. use Number.parseLocale instead of pareFloat so that it get correct value according to the current culture. 4. to update the value back with current culture use localeFormat <script type="text/javascript"> function ...
Introduction I don’t do web programming… I have been programming client applications for years and consider myself a WPF/Silverlight developer. The web thing always seemed a bit scary in its stateless environment with limited functionality and cross browser headaches. That was until recently when apparently HTML5 was going to kill Silverlight and I eventually decided that I would need to get educated and up to date. Since that decision I have re-accustomed myself with HTML, CSS & JavaScript. ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. Today we are going to examine the LINQ set operations that are part of the IEnumerable<T> extension methods. Now, most of the time when people think of set operations they think of the math or logic classes they are usually taught in, but really these LINQ methods have a much larger appeal and applicability than just math ...
When you have Microsoft Office Communicator or Lync installed, and you visit a SharePoint site, you will get these presence indicators next to peoples’ names These indicators (or jelly beans as they are affectionately called) show whether the person is available, in a meeting, out of the office, on a call, etc. When you hover over them, they provide details about the person In SharePoint 2007 (or any other web page), whenever I needed to display a presence icon in custom code, I just use the following ...
I have lost recently some time to send a json parameter to my web service using jquery. Suppose that we have the data in an javascript array: var attributes=[]; $('#PreviewGroup1_DecisionA... input:checkbox').each(funct... attributes.push({attribute: elem.value, checked: elem.checked}); }); To send that array to web service we simply need to do $.ajax({ url: '../Services/PreviewFormWeb... dataType: "json", data: "attrs="+ JSON.stringify(attributes), ...
Project Silk provides guidance for building cross-browser web applications with a focus on client-side interactivity. These applications take advantage of the latest web standards like HTML5, CSS3 and ECMAScript 5 along with modern web technologies such as jQuery, Internet Explorer 9, and ASP.NET MVC3. To illustrate this guidance, the project includes a reference implementation called Mileage Stats that enables its users to track various metrics about their vehicles and fill-ups. Much of the effort ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. Most of my time this week has been spent finishing the current iteration at work and updating a presentation for the Springfield DNUG, so today’s post will be a bit on the lighter side, but I wanted to continue my post series so I thought it would be a good time to quickly mention the ElementAt() and Last() LINQ extension methods. ...

Add add_endRequest handler to the Page request manager as followed

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(<javascript name function>);
Just uploaded my presentation to the Springfield (Missouri) Dot Net Users' Group to Slideshare at http://www.slideshare.net/B... Automating C# Coding Standards using StyleCop and FxCop View more presentations from BlackRabbitCoder Tweet Technorati Tags: C#, .NET, StyleCop, FxCop ...
Well, this one was fun. So my mvc app was having trouble with javascript files. Seems like if I had more than one file linked in, that only the 1st was picked up. The tags looked like so: <script src="<%=Url.Content("~/S... type="text/javascript"/> After much scratching my hair out and trying different things, I figured it out. The problem is the />. You have to end the script tag like so with </script> and not the shortcut syntax: <script src="<%=Url.Content("~/S... ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can really help improve your code by making it easier to write and maintain. Today we’re going to look at two more handy LINQ extension methods: the Any() and All() methods. These methods can help you examine an enumerable collection to determine if any, or all, of the items in the collection meet some logical condition. Any() – Checks for at least one match The Any() method is a LINQ extension ...
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* 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; ...
A new release of Microsoft All-In-One Code Framework is available on April 16th. This blog introduces 14 ASP.NET and Azure code samples in the release. The rest new samples will be introduced next week. Download address: http://1code.codeplex.com/r... Alternatively, you can download the code samples using Sample Browser v3. The new Sample Browser gives you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically ...
How doing some asp.net deevelopment and i decided to use one of the asp.net controls. But need to use Jquery to do some extra stuff I had a link in the page i wanted to let popup like a modal dialog like so: <td><a id="mdialog" href="details.aspx?scode=&l... Eval("Code")%>">[..]&... Then refrenced Jquery like so: <script type="text/javascript"> $(document).ready(function () { $("#mdialog]").fancybox({ 'width': '75%', 'height': '100%', 'autoScale': false, 'transitionIn': ...
Ajax enabled data centric applications are getting popular day by day in web development space. While these type of web applications provide rich user experience, building a robust and powerful application quickly is a great challenge for developers. Fortunately Microsoft has started providing great frameworks, plug-ins and APIs to facilitate this process. Last week Microsoft announced a new version of java-script API “datajs”, which is intended to help web developers to build data centric AJAX applications ...
At the recent Mix 2011 conference the datajs team talked about this new cross-browser JavaScript library that makes writing data centric web apps easier. Its fairly simple to use and can be very powerful. Here is a quick application I threw together using the library. The code uses datajs, jQuery, jQuery UI and jQuery templates. Microsoft has an OData Service at http://live.visitmix.com/od... which exposes all Mix sessions. I used this source to get a list of all sessions using the datajs ...
HTML5 introduces markup-level functionality for rich graphics, animation and web multimedia. It also supports a richer web application functionality and extends the client capabilities with local storage. Many pundits see it as the next generation web - web 3.0 if you like - and an open standard replacement for propriety plug-ins, Microsoft Silverlight and Adobe Flash. But, for all its new features, HTML5 is still only the end product. This article looks at HTML5 from the web programmer's point of ...
I haven't posted a recap lately, because the Virtual Brown Bag recordings weren't being uploaded for a while. That was fixed two weeks ago, so I had a lot of meetings to catch up on. Here's an all-you-can-eat brown bag buffet… March 3 Guest presenter Jim Christopher - creator of StudioShell, a deeply integrated PowerShell host available inside of Visual Studio 2010 and 2008. StudioShell exposes many of Visual Studio’s extensibility points in a simple and consistent way, and it makes the Visual Studio ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can really help improve your code by making it easier to write and maintain. Today we're going to look at two LINQ extension methods that are both very similar and yet very different. Logically, First() and Single() serve similar purposes, but there is a subtle difference between these two that if you aren't expecting it may give you very different behaviors. First() - Retrieves the first occurrence ...
Last week, I was interviewed by Zandra Nilocas from Microsoft Philippines. It was my first time experience to talk about something in front of the camera so it's not surprising that I looked like an idiot in that interview (you know swiveling my chair back and forth without noticing it). Anyway in the interview we talked about ASP.NET WebForms, MVC and Web Matrix in general and just to elaborate a bit of what we talked about and to clarify things out, I have decided to write this post... WebForms ...
Recently, while browsing Visual Studio extensions I came across the SharpKit tool. It sparked my curiosity as I'm always looking for ways to improve my jQuery and Javascript in general. Working off the example in my previous post about Updating the Content of a WebGrid async we can generate the same Javascript via the SharpKit project. First, head to theSharpKit site to download and setup your first project (check out the Screencasts). Or search "jQuery" in Visual Studio 2010 extension manager. So ...
Anteriormente escribe un pequeño código para validar que en un textbox solamente se ingresaran números. Hoy mostraremos como validar nuevamente el textbox pero esta vez, para que acepte solo caracteres. Como es de recordar, tendremos que utilizar javascript para obtener esta funcionalidad. Nuestro script sería de la siguiente forma <SCRIPT language=Javascript> <!-- function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode ...
Cuanto trabajamos con formularios, siempre es necesario limpiar todos los controles luego de que el usuario a realizado determinada acción, por ejemplo, luego de que ha guardado un dato. Esto nos ayudará a evitar errores en el ingreso de la nueva información. Este es un pequeño código en javascript que se encarga de realizar esa tarea, al menos, en los controles más comunes. Por supuesto, que es totalmente extendible. <script language="javascript" type='text/javascript'> function ClearAllControls() ...
We all love benchmarks! With the recent release of new versions of some of major browsers, and as a small diversion over the weekend, I ran five well-known browsers against five well-known JavaScript micro-benchmarking suites using my laptop. The results are reproduced below. I have ranked the results for each benchmark suite from best to worst. Celtic Kane – old version (current version was unavailable) (Smaller is better) Opera 11 77 ms Safari 5 93 ms Chrome 10 119 ms IE 9 152 ms FF 4 154 ms Kraken ...
Previously we've talked about how to fetch the data from the database and populate the form with EF. In this example I'm going to demonstrate how to do Edit,Update and Delete operations in the form with Entity Framework. And oh since this is a continuation of my previous example I would suggest you to refer that first before you go any further. STEP 1: Setting up the UI Since this is a continuation of my previous example then I'm jus going to use the same layout and extend it a bit by adding some ...
This post is another in a series that will just contain little GUCs (Generic Utility Classes) I’ve developed along the way. If these already exist as part of the framework and I’ve overlooked them, feel free to let me know! And if you know of a better way to implement them, do the same! I’m never too old to learn something new (I hope!). I've blogged in the past about how useful the overlooked HashSet class can be (here) and about the very useful ToDictionary(), ToList(), and ToLookup() LINQ extension ...

Microsoft:  http://aspnet.codeplex.com/releases/view/40584

Google:  http://code.google.com/p/minify/ ;  http://code.google.com/closure/

 

 

Some online ones that takes a block of javascript:

http://jscompress.com/

http://www.minifyjavascript.com/

A simple script you can add to your master page or content editor etc. to hide the “Sign in As a Different User” option that is available in the Personal Actions Menu. <script src="/jQuery/jquery-1.4.1.js" type="text/javascript">&... <script type="text/JavaScript"> jQuery(document).ready(func... { var objects = document.getElementsByTagNa... for (var i = 0; i < objects.length; i++) { itm = objects[i]; if (('#' + itm.id).indexOf("LoginAsDif... ...
At TechEd India 2011 I presented on HTML5 Development with Visual Studio 2010 SP1. I wanted to cover the aspects that were discussed in my session. HTML5 1. HTML5 is the emerging but promising trend in web development 2. Some of the standards have got green signal i.e. they are candidate recommendations. 3. Some others are still work in progress. 4. IE9 implements standardized HTML5 specifications. Visual Studio 2010 and HTML5 Visual Studio 2010 Service Pack 1 comes from basic HTML5 support. Having ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can really help improve your code by making it easier to write and maintain. LINQ has added so many wonderful extension methods to our .NET toolbox! In particular, there are a few methods that are useful for creating a collection from an IEnumerable<T> instance. The ToDictionary() and ToList() extension methods, for example, are handy for taking an IEnumerable<T> and creating a Dictionary ...
The title of this blog post is a lie. I don't actually love MFC C++, in fact I think it's safe to say I hate it. Hate may actually not be a strong enough word... but it's the best I can do at the moment. Recently, I had the pleasure of having to come up with a printing solution for Windows Mobile 6.5 devices. For those of you not in the know (which until recently included yours truly) there's no printing capability in Mobile IE 6. As in... NONE. There's no print option hiding on a menu somewhere, ...
Yeah I know I don’t blog much anymore, because life has taken me places that don’t involve the interwebs unfortunately. I am in the midst of planning two events, starting a non for profit, creating more sessions for various conferences, submitting to various conferences, working a 40 hour a week job, attempting to hang out with boyfriend/friends/family. So you can see that list does not include this blog sadly that’s how it goes sometimes. The bottom piece very important over any of the top pieces. ...
Recently I wrote about JavaScript class patterns, and in particular, my favourite class pattern that uses closure to provide encapsulation. A class to represent a person, with a name and an age, looks like this: var Person = (function() { // private variables go here var name,age; function constructor(n, a) { name = n; age = a; } constructor.prototype = { toString: function() { return name + " is " + age + " years old."; } }; return constructor; })(); var john = new Person("John Galt", 50); console.log(john.toString()); ...
The day has finally come: Microsoft has released a web browser that is awesome. On Monday night, Microsoft officially introduced the world to the latest edition to its product family: Internet Explorer 9. That makes March 14, 2011 (also known as PI day) the official birthday of Microsoft’s rebirth in the world of web browsing. Just like any big event, you take some time to celebrate. Here are a few things that you can do to celebrate the return of Internet Explorer. 1. Download It If you’re not a ...
v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} Normal 0 false false false EN-GB X-NONE X-NONE MicrosoftInternetExplorer4 /* 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:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.000... ...
A new release of Microsoft All-In-One Code Framework is available on March 8th. Download address: http://1code.codeplex.com/r... You can download individual code samples or browse code samples grouped by technology in the updated code sample index. If it’s the first time that you hear about Microsoft All-In-One Code Framework, please read this Microsoft News Center article http://www.microsoft.com/pr... or watch the ...
Ever wanted to have a simple jQuery menu bound with ASP.NET web site map file? Ever wanted to have cool css design stuffs implemented on your ASP.NET data bound controls? Ever wanted to let Visual Studio generate logical layers for you, which can be easily tested, customized and bound with ASP.NET data controls? If your answers with respect to above questions are ‘yes’, then you will probably happy to try out latest release (v5.0) of Employee Starter Kit, which is intended to address different types ...
Who has not seen the Code Project's Tech Virtual Summit on Mobile Development, you can now see all the sessions on demand. The sessions are: The Mobile Development Landscape Android Push Notifications Beginning Android Flash Development Android for .NET/C# Developers Using MonoDroid iPhone 101: Introduction to iPhone and iOS Development Building Rich Mobile Apps with HTML5, CSS3 and JavaScript Building MVVM apps for Windows Phone 7 Using Panorama and Pivot Controls for WP7 apps Building Data Visualization ...
I was debugging a script injection issue the other day using some sample code with an alert in it. The alert was popping out meaning the code got executed leaving open the possibility for a hacker to put there some nasty malicious code. I knew my alert was being executed but didn’t know how. So I tried something that worked perfectly for this problem, replaced the native alert function with my own one. All I had to do in Chrome was open the javascript console and type: alert = function(msg){ console.log(msg); ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can really help improve your code by making it easier to write and maintain. This week, we look at the System.Tuple class and the handy factory methods for creating a Tuple by inferring the types. What is a Tuple? The System.Tuple is a class that tends to inspire a reaction in one of two ways: love or hate. Simply put, a Tuple is a data structure that holds a specific number of items of a specific ...
I had always been a fan of ANTS products (Reflector is absolutely invaluable, and their performance profiler is great as well – very easy to use!), so I was curious to see what the ANTS Memory Profiler could show me. You can check out more information about the profiler at Red Gate's web site at www.red-gate.com/products/d... Background While a performance profiler will track how much time is typically spent in each unit of code, a memory profiler gives you much ...
I was facing a challenge yesterday that I was creating a Visual webpart and I wanted to validate the a submit button is only visible if the user checked a "I agree to terms" checkbox. Something was weired that I tested my code on a normal asp.net website and it worked perfectly while it had a different behaviour inside the webpart which is whenever I check the checkbox, the button is enabled but it will not fire the asp.net validators in client side. It posts back the page and then the validators ...
I've recently used a cool .Flv player to play video files that are uploaded by site admin and thought it's good to share. Download from: http://flowplayer.org/ Using this control is very simple, just follow those steps : 1. Create an anchor with href equals to the video url <a href="Video.flv" id="MyPlayer" ></a> 2. Add path to the player's javascript file <script type="text/javascript" src="flowplayer-3.2.4.min.j... 3. Simple call to a function named flowplayer with ...
In the first week of concurrent collections, began with a general introduction and discussed the ConcurrentStack<T> and ConcurrentQueue<T>. The last post discussed the ConcurrentDictionary<T> . Finally this week, we shall close with a discussion of the ConcurrentBag<T> and BlockingCollection<T>. For more of the "Little Wonders" posts, see C#/.NET Little Wonders: A Redux. Recap As you'll recall from the previous posts, the original collections were object-based containers ...
A developer is asking how to select one radio button at a time if the radio button is inside the GridView. As you may know setting the group name attribute of radio button will not work if the radio button is located within a Data Representation control like GridView. This because the radio button inside the gridview bahaves differentely. Since a gridview is rendered as table element , at run time it will assign different "name" to each radio button. Hence you are able to select multiple rows. In ...
I wanted to try to use T4 to read a web.config and generate all of the appSettings and connectionStrings as properties of a class. I elected in this template only to output appSettings and connectionStrings but you can see it would be easily adapted for app specific settings, bindings etc. This allows for quick access to config values as well as removing the potential for typo's when accessing values from the ConfigurationManager. One caveat: a developer would need to remember to run the .tt file ...
The Original Posts I had written a pair of posts before about creating a debug-able and self-installing windows service template in C#. This is a template I began creating to ease creating windows services and to take some of the mundane tasks out of the coding effort. The original posts were here: C# Windows Services (1 of 2) - Debug-able Windows Services C# Windows Services (2 of 2) - Self-Installing Windows Services But at the time, though I gave the code samples I didn't have a downloadable for ...
User-Defined Functions Scalar User-Defined Function A Scalar user-defined function returns one of the scalar data types. Text, ntext, image and timestamp data types are not supported. These are the type of user-defined functions that most developers are used to in other programming languages. Table-Value User-Defined Function An Inline Table-Value user-defined function returns a table data type and is an exceptional alternative to a view as the user-defined function can pass parameters into a T-SQL ...
Once again we consider some of the lesser known classes and keywords of C#. In this series of posts, we will discuss how the concurrent collections have been developed to help alleviate these multi-threading concerns. Last week’s post began with a general introduction and discussed the ConcurrentStack<T> and ConcurrentQueue<T>. Today's post discusses the ConcurrentDictionary<T> (originally I had intended to discuss ConcurrentBag this week as well, but ConcurrentDictionary had enough ...
I recently described some of the patterns used to simulate classes (types) in JavaScript. But I missed the best pattern of them all. I described a pattern I called constructor function with a prototype that looks like this: function Person(name, age) { this.name = name; this.age = age; } Person.prototype = { toString: function() { return this.name + " is " + this.age + " years old."; } }; var john = new Person("John Galt", 50); console.log(john.toString()); and I mentioned that the problem with this ...