Loading... Born a day after the American Independence in Jalandhar, Punjab, India, I've spent most part of my life there. Studied till 5th standard in St. Joseph's Convent School, Jalandhar, and later had to join Apeejay School, Jalandhar as, perhaps, the former school decided boys could be troublesome in a girls' school after 5th. After completing schooling in APJ (till 12th), joined National Institute of Technology [NITJ] (again, in Jalandhar) as a Computer Science & Engineering student in 2005. During the worst period of downtime (recession), got an on-campus placement in Accenture in 2008. Graduating from college took another year after that, and finally joined Accenture in mid-2009. This is my story so far... Btw, you can find me at: facebook twitter last.fm digg librarything granular
Sep 27

ASP.NET controls essentially translate to a bunch of HTML and JavaScript code when being rendered in the browser, because HTML and JS is all what a browser can understand. So does that mean you can access an ASP.NET control with ease through JavaScript? Yes and no. Really depends on the version of .NET installed on the server (hosting your ASP.NET website).

HTML controls/elements/tags are generally referred to by their IDs. In plain JS, we would do something like:

var name = document.getElementById('txtName').value;

In jQuery, that would translate to:

var name = $('#txtName').val();

That’s assuming that your page has a text box with the ID ‘txtName’. One would expect that ASP.NET controls can also be referred to by their IDs in JavaScript. But that’s not always true. Prior to .NET 3, a compiler-generated prefix used to get added to a control’s ID (while rendering it in browser), to form what’s called the control’s ClientID. An example of such a ClientID can be “ctl00$mainpage$txtName”. In short, if you have an ASP.NET 3.0 textbox control having an ID ‘txtName’, you can access it in JavaScript like:

var name = document.getElementById('txtName').value;

But obviously, that won’t work in case of ASP.NET 2.0, because the actually ID you want to refer to is “ctl00$mainpage$txtName”.

That is where the ASP.NET short tag notation comes into play. Regardless of whatever version of .NET is installed on your server, you can access an ASP.NET control in JS in the following way:

var name = document.getElementById('<%= txtName.ClientId %>').value;

Of course, you can directly do something like:

var name = <%= txtName.Text %>;

Well, all depends on your needs. This tip is just meant to get you started with the interoperability between ASP.NET and JavaScript. And remember, the ASP.NET short tag notation works the same way in case of HTML too.

Further Reading
You can even have ASP.NET methods return data to your JavaScript code. That can be done with a little-bit of AJAX and by declaring your ASP.NET methods as webmethods. This beautiful tutorial discusses how to do just that (in plain JS and in jQuery)

Tagged with:
Aug 02

Enough! The huge defeat of the no. 1 Cricket test team at the hands of the English side was enough humiliation for the players already. But think about it, the Indian team lost the match because they didn’t have the will to win? True that the Brits had a seemingly more fierce hunger for a win, but how did they go about it? By practising. Now don’t even start by saying that India had the best and most experienced players in Tendulkar, Dravid, Laxman and Harbhajan. Experience is one thing, but you need constant practice to keep yourself upto that level, especially in tests. But where was that practice? And who is culpable for that? The players, who never got the time and chance to acclimatize themselves on foreign soil? No. It’s the board, of course, who truly deserves the blame.

On one hand, BCCI wants to fill their vaults with huge piles of cash, and at the same time wants its players to “switch” between different formats of the game within the matter of days. They even forgot that the Brits were going into the series with a big advantage at their side – home conditions. And given the Indians’ lack of ability to play the swing and short balls, what did the board do to correct that? If it could not arrange for west-like bouncy pitches in India itself (for simulation of foreign conditions), they could, at least, have arranged for more time for the Indian team to practise in England itself before the start of the series. Shame, a real shame that did not happen.

I bet the day when the board starts caring less about the money and more about the true spirit of the game, India will start winning matches, consistently.

Tagged with:
Jul 16

Sometimes watching a movie, a TV series, or reading a book can be so inspiring as to spontaneously start a chain reaction of beautiful thoughts in mind. I just happened to watch such an inspiring episode of a science documentary called Into the Universe, presented by Stephen Hawking on the Discovery Channel. The episode titled “The story of everything” contained so much information that I had to take several pitstops in between, pausing from time to time to grasp what had been told. From the origin of the universe to the creation of stars, Earth and other cellestial objects to the creation of life, it’s one hell of an interesting (and thought-provoking) story told in a so effectively simple manner as to hold one mesmerized and wondering (in amusement) about the different phenomena described.

Weird how the mind can be so random about thoughts. In the moments of silence that followed my watching the documentary, my mind switched between thinking again of the various physics/cosmic concepts that were told to the equally intriguing economic/behavioral laws.

As I (like everytime) cannot stop myself from sharing my thoughts, here’s what’s keeping my mind captivated.

Big Bang – The Big Bang model, or theory, is the prevailing cosmological theory of the early development of the universe.
Creation of a star
Creation of all the elements around us
Doppler Effect – the change in frequency of a wave for an observer moving relative to the source of the wave.
Black Holes – regions of space from which nothing, not even light, can escape.
Supermassive Black Holes – the largest type of black holes in a galaxy, in the order of hundreds of thousands to billions of solar masses.
Milky Way – the home galaxy of the Solar System, and of Earth.
Law of diminishing marginal utilities – the marginal utility of each (homogenous) unit decreases as the supply of units increases (and vice versa).
Pareto Principle – for many events, roughly 80% of the effects come from 20% of the causes.

On another note, it has just started raining (violently) out of nowhere, after a bright & sunny day. I can hear the distant cries of people screaming outside.  

Tagged with:
Jun 16

Accessing the songs in your iPhone or iPod Touch through an application other than iTunes might get the album (cover) art of some or all of your songs completely messed up. Messed up as in missing or mismatched album arts. This happened to me when I played certain iPod songs in Banshee and Rhythmbox (music players for Linux). If you’ve gotten in a similam situation, here’s what to do to fix it.

The trick is to play each and every song in your collection in iTunes (with a bad album art) for a few seconds. Yes, it may turn out to be a time-consuming and lengthy process, but the only way to fix the issue. If you have a super-huge collection of songs, then God save you. ;)

Posted from Apple Computers Ipod Touch

Tagged with:
May 16

Wow! I got my Portal 2 the next day of ordering it from an Indian online games store (nextworld.in). That was impressive!

Immediately after finishing Portal (the prequel), I wanted to play the sequel (ah yes, I knew at the time that a sequel was in the pipeline). Portal was damn good: a fun way of solving puzzles the FPS way. Now to get my hands on the live gameplay when I get the time to install it. :)

Tagged with:
preload preload preload