11 April 2011

SQL - trigger fired when table is not updated

Hi,

First of all what microsoft tells us about triggers:
"A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server. DML triggers execute when a user tries to modify data through a data manipulation language (DML) event. DML events are INSERT, UPDATE, or DELETE statements on a table or view. These triggers fire when any valid event is fired, regardless of whether or not any table rows are affected."
            Taken from: http://msdn.microsoft.com/en-us/library/ms189799.aspx
There is something interesting in above sentences, I suppose many of us would not understand correctly the last sentence: "These triggers fire when any valid event is fired, regardless of whether or not any table rows are affected". I have also walked through these problems some days before.

09 March 2011

CheckBox "onchange" event fired before "onclick" event in Google Chrome

Hi,

      When working on another Javascript Library I have found another problem or maybe I am wrong and this is expected behavior. The problem is:
           - In Internet Explorer - onchange event is fired after the onclick event;
           - In Google Chrome - onclick event is fired after the onchange event.

      I am not sure about other browsers.

      All this refers to checkbox only, because I didn't try others, but I guess radiobuttons have the same issue.

ASP.NET __doPostBack not working

Hello,

Did it happened so that you try to use __doPostBack javascript function but it didn't work?

 __doPostBack - is a function which makes a postback to the server with an target element ID, and it should also fire the corresponding Event on server-side automatically. This is a very useful function.

Well there are several possible situations that I know where it doesnt work:
1) because you are passing an invalid ID;
2) you should use btnObj.ClientID for ASP.NET controls
3) because you are trying to call __doPostBack for a button that is placed on a page with Master Page or for a button that is inside an ASCX control.

Make HTML elements like DIV, SPAN, Table focusable

Hello,

When you need to detect onkeydown event it is fine to do this with focusable elements like: inputs, dropdowns,..., but what to do with non-focusable elements like DIVs, SPANs, TABLEs?

You can achieve this by adding TABINDEX attribute to these elements, this way browsers will consider that element as a focusable element.

Also depending of what value you set to tabindex attribute - it will behave differently:

ASP.NET Dynamic Data - Default sort Table by specific column(s)

Hello,

      ASP.NET Dynamic Data brings major usability and RAD development changes to the existing ASP.NET data controls. RAD development is significantly increased by the use of a rich scaffolding framework.

      The DetailsView and GridView controls have been extended to display fields by using templates instead of by using hard-coded rules that are programmed in the controls. These templates are part of the project, and you can customize them to change their appearance or to specify which controls they use for rendering. This makes it very easy to make a change in one place in your site that specifies how to present dates for editing, as one example.

      But it is not so flexible as we wanted and it does not allow default sorting on tables.

      Here is a solution of how to make your ASP.NET dynamic data GridView sorted by default. This solution will require you to create an attribute - MySortByAttribute which will contain 2 proprieties: SortExpression (of type: String) and SortDirection (of type: SortDirection).

Height 100% does not work

Height 100% does not work ?

When you put a height for an element inside the page to have 100% of the parent element it does not work?
This is correct.

I have also had this problem and I have found out that this is because when you put 100% it will take 100% of the height of the html document or 100 % of the body.

But in modern browsers html's and body's default height looks to be set to 0 pixels. Which means that their height will be adjusted to the height of inner elements.

So what to do if you want your element to be 100% of the browser window?
ANSWER: make html and body to have height set to 100%, in this case these will take 100% of the window and this way you will be able to set the height for the elements inside html and body needed value in percents.

window.showModalDialog() - Cross Browser, new version

Hello,

This is a continuation, or a new version for my last post about window.showModalDialog().

The new version was implemented as a jQuery function to which you can pass options which you like.
This version was made because:
    1) The impossibility of previous version to retain dialogArguments during postback;
    2) The impossibility of previous version to close the dialog when the target page is inside several iframe tags;
    3) The impossibility of previous version to retain window.returnValue during postback;
    4) It will be possible now to fire a postback of the page or to fire a postback of a element (with targetElementId) right after the dialog was closed and the callback function finished to execute;
    5) Theoretically this popup library can be used to open another popup inside an existing one (Note: I haven't tried this yet).

However, previous version of my showModalDialog can satisfy someone's requirements and it will be no need to complicate his life with the new version.

XML Parsing and other XML Utilities - Cross Browser

Hello,

Are you searching for an alternative to new ActiveXObject("Microsoft.XMLDOM") which will work in all popular browsers? Then here it is a solution.

This Javascript library will give you the possibility to do almost everything what you could do with ActiveXObject("Microsoft.XMLDOM") but in different browsers.

IE window.showModalDialog() - Cross Browser solution

Hello,

QUESTION: How to make window.showModalDialog() work on cross browser? or at least how to do something similar? with arguments, return value and window.close()?

ANSWER: There is no simple way to do that.

ATTENTION: dialogArguments will be lost if the page inside the popup will do a postback. For a better solution see my new version - click here.

First of all window.showModalDialog() function is something which works only on Internet Explorer and in the best case this command will open a new small window on some browsers, however this window is far from a modal window.

If you still need to have the same functionality as window.showModalDialog(), to pass some parameters / arguments to the page inside the popup and then return some values back from that page in the parent page, and also have the ability to close the popup from the inside of the popup then this article is for you.

Here I have created a modal popup, using jQuery, which gives you the ability to pass arguments to the page inside the popup almost in the same way as you would pass it through showModalDialog().

02 March 2011

SQL - How to check if a string has uppercase / lowercase characters

Hello,

When you need to compare two strings in SQL to check if this string contains uppercase or lowercase values it is always a problem, because in sql "ExTremeDev.blogSpot.com23" is equal to "extremedev.blogspot.com23".

I also needed to do such thing, in order to make some rules for a password, so that it will contain numbers, uppercase characters and lowercase characters.

Here I will provide an example like that:

03 February 2011

Menu on multiple lines - Cross Browser


Hello,

Sometimes the menu which you need to display is generated using a repeater and you do not know exactly how many items will be displayed, and here you need a menu which will wrap in case there is not enough space.

I have also searched for this kind of menu on the internet but I could not find one. This is why I decided to create one by myself.

Well of course some ideas are take from some samples but in general I had to rewrite some code and change CSS, in order to make it to work how I needed and cross browser.

The height of the menu items are automatically readjusted to be the same. This is done because otherwise the menu will not be displayed correctly.

23 January 2011

IE window.createPopup() - cross browser solution

Hello,

Probably a lot of you came to the situation when you needed to have a popup as the one which IE is providing when using window.createPopup().

I have surfed a lot on the internet, but I couldn't find a solution that would satisfy my requirements. This is why I decided to create my own library in Javascript. I will provide the code of it below in this post.

Note: jQuery is used in this code, this is why you will need first of all to include jQuery library (Core & UI) before below code.

Need more? Leave comments and subscribe to my blog.

.