Building a ul li treeview recursively in asp.net

Recursion can be a bit tricky to master, however comes handy in many situations. One very common and popular use is to build treeview structure. Here is a very simple approach of building a treeivew recursively in C#. Before we jump into recursion we need to realize the specific style to store the data, here is the sample I have used. It uses a "ParentID" to determine whose child it is and this makes it possible to build a tree view to "n" levels of depth.

Saving Image as Data using dataURI

By using a method called “Data URI Scheme”, images can be directly embedded in HTML files. An image is converted to data uring base64 encoding, the data is appended in the page, which works as the image itself. The data URI scheme is a URI scheme (Uniform Resource Identifier scheme) that provides a way to include data in-line in web pages as if they were external resources.

Using jquery on event handler for dynamic elements

When we started building dynamic elements with jQuery, the issue of registering events to the dom used to be a hassle. Then .live() came to rescue where irrespective of the when the element is added to the DOM, the events associated could be triggered dynamically. But now live() is deprecated and jQuery recommends using .on(). On() works fine everywhere and we do not even realize or even bother to find out what is the benefit of using .on() over .live() or why has jQuery given up on the beautiful sounding “live” function.

Using Gravatar Image in your site

Lately, any web savvy is confounded by a slew of accounts to maintain and passwords to remember. The hassle of remembering multiple email accounts to some extent has been solved by the concept ot Open IDs. GRAVATAR addresses another such issue of managing your profile picture across a number of accounts. Be it from the perspective of maintainability or from your "online brand consistency", reusing profile picture from a single place is a cool idea. So Gravatar offers such service where one can upload an "avatar" mapped with a certain email address which can be later reused into a number of sites.

Developer’s ramblings

As a developer, even the thought of talking in front of a crowd could be intimidating, especially if you are the kind of developer with the “weird” habit of talking to yourself; well you may have this thing coz computers don’t talk unless there are some free people on the other side of the “internet”. I teach ASP.NET and Web Tech in a college for BSCIT students. It is more like training than teaching because it is all about knowing “how to do it” instead of “what it is”. Moreover, with programming courses like asp.net, the whole idea of teaching could boil down to simple demonstrations

Unbinding jquery events after jquery live

I was working on a small project where I had to load .ascx controls using jquery. I used string writer to load the jquery html into my parent control on click. Now I had registered event handlers for the loaded control using .live. When I loaded the control for the first time, it was fine. But after that everytime I loaded the control, the event associated excecuted multiple times which was not supposed to happen. It looks like every time the control is loaded, the live event is registered again resulting multiple events to execute.

Simulating slow connections using SpeedLimiter

Well, it is most of the times we are always craving for a better bandwidth, but there are times when we want to work on minimum bandwidth. This happens often in testing scenarios. Recenty I was working on a small project which required the use of ajax indicator. As I was working on my localhost, I couldn’t even see properly how the ajax indicator looked like. So I searched for a way to simulate the real “internet” scenario i.e. simulating low bandwidth in my localhost and I found SpeedLimiter quite handy in doing so.

Using and not using a Content Management System

The web is so much stuffed with CMSes these days, good CMSes and bad CMSes ,Open Source CMSes and not-open source CMSes. A normal computer user surfing general internet for news and stuffs is inadvertently clicking those CMS powered sites. CMSes mostly are purposed to build websites. With a lot of plug and play mechanisms ranging from functional plugins to design templates (installable and switchable), CMSes do make the web site development and “maintenance” quick and cheap(less expensive).

CSS opacity without affecting the text

The opacity attribute forces all the child elements to also become transparent. On the other hand ‘rgba’ includes alpha transparency support leaving the descendents unaffected. Here is a simple fiddle to demonstrate the same.

Rewrite URL without redirecting in jquery

Here is a simple trick to rewrite the URL of a browser without redirecting using jquery.

Cannot find the apk file android phonegap

While I was debugging a phonegap build of a jquery mobile application (android), I encountered the following error "Cannot find the .apk file"

jQuery attr vs prop

jQuery has the new function prop()as mentioned in their release.

Strip out inline style in jquery without using regular expression

A simple method to strip out inline style from a html string in jquery.

Avoid Inserting Duplicate Record on Page Refresh

While working with asp.net forms, a common problem one faces is the resubmission of data everytime the page is refreshed.

Using jquery map function with arrays

translates all items in an array or object to new array of items

Bootstrap compatibility issue for IE7

Apparantly IE doesnot support media queries which is the heart of bootstrap framework

Saving Changes Is Not Permitted On SQL Server 2008

Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.

Page: 1 of 1