Jquery tips, using not

Today I hade problem with a Jquery selector that was supose to select every visible items in a list. The visible or not visible is toggled with show and hide function. The result is that the style attribute display is either none or empty.

$(‘li.instruction:visible’).each(function () {


If the list where the item belongs to is not visible for some reason in my case because of  multiple tabs, it worked as long as the active tab was the same as the list belonged to, otherwise the selctor visible failed, or failed is the wrong word, it is sureley true the list and any items in it is no longer visible.

This is a safer aproach, works even if the list itself is hided.

$(‘li.instruction’).not(”[style=’display: none;’]”).each(function () {


Problem with gridview or any other asp control events

In my current project I had problem with the execution orders on a ASP.NET page, I use a databound gridview, that databinds in PageLoad. But when I then hit the select row and that event fires I dont want to databind on PageLoad of course, but how to I do that? The Execution order is first PageLoad then SelectedRowChange on the gridview. This is my solution:

if (Request.Form["__EVENTTARGET"] != GridView1.UniqueID)

    GridView1.DataSource = GetTransactionData(

"", false);

Note that I can do a check of what triggered the page reoload, and then skip the databinding if the gridview populated this, because i know that the row index change event on the gridview will take care of the databinding. Time for lunch now 🙂