Monday, July 9, 2012

ASP.Net Menu and Rendering Issue in IE8

If you have ever used ASP.Net built in menu with dynamic data binding, you might have encountered an odd rendering issue with IE8.Instead of displaying the sub menu items, it would be displaying empty white boxes. Strange, isnt it? J .I would become more odd when u realize this is not happening for static data binding.. You might have wondered How come it happens, IE8 being a Microsoft outcome.
How to Overcome?
Here is the root cause of the issue.IE8 returns Z-Index property as “auto” until unless we have explicitly  specified it as some other value.

1. Override Z-Index property

One of the possible workaround is to override the Z-Index property, so that the application would not return Z-Index as “auto” any more.

2. Render the Application in IE7 standards

You can also overcome the issue by applying IE7 Meta tag to the HTML. By applying IE7 Meta tag, which forces the application to render in IE7 standards. Cool ,Huhh? J

IE8 Rendering Issue fix

Friday, July 6, 2012

ASP.NET Page Life Cycle Events

When a page request is sent to the Web server, the page is run through a series of events during its creation and disposal. In this article, I will discuss in detail the ASP.NET page life cycle Events 

(1) PreInit
(6)Control (PostBack) event(s)

(1) PreInit

    This is the very first page event that gets fired when a request for a page occurs.We can say "PreInit" as the entry point to the Life cycle events.At this satge we can dynamically set the master page,  set their skin properties and can access the controls in the master page as well.
From  the code block ,we can see how the master page has been set at runtime and how i accessed the controls in the master page dynamically.If u try to set the master page in any othe page events it will though error.

(2) Init

  This event fires after each controls has been initialized,their UniqueId has been set and skin settings have been applied .This event gets fired in the revers heirarchy order ,ie starting from child control to the parent ones untill its fired for the page itself.
We can use this method to change the initilization values of the control.

(3) InitComplete
 This event is rised once initialization of all controls and page completed. From this state onwards the ViewState for server controls become accessible.

(4) PreLoad
    This is the first event where viewstate functionality starts retrieving their values.In this method, page will load values from viewstate.

     The page Load events executes after the Page_PreLoad event.By now the page has restored to its initial state in case of postback.Code inside the page load event typically checks for PostBack and then sets control properties appropriately. 

 (6)Control (PostBack) event(s)

   ASP.NET now calls any events on the page or its controls that caused the PostBack to occur. This might be a button’s click event or a dropdown's selectedindexchange event, for example.These are the events, the code for which is written in your code-behind class(.cs file). 



  This event signals the end of Load.We can use this event for the tasks which require all the controls in the page to be loaded.


  This event gets fired when page had loaded all the controls that user could see in his browser.This is the last event that could reflect any changes in the page ,that has to be shown in the browser.The PreRender event occurs for each controls in the page.


  Prior to this event ,ViewState have been loaded for page and for all the controls.Any changes to the page or controls at this stage will be ignored.We can use this event for tasks that require all ViewSate valuesto be saved,but that do not make any changes to the controls.

(10) Render

 The rendor method generates the client side HTML,DHTML and scripts that is required to render the output in the browser and to implement the client side functionalities.

(11) Unload

  This is the last event that gets fired.At this stage you can dispose any object and references that has been made to construct the page including the page object.

Thursday, June 28, 2012

Manipulating XML with C#

Here i am going to demonstrate how to parse through XML documents and iterate the node values and names in simple steps.

Step 1: Add the required name spaces

using System.Xml;
using System.Xml.XPath;
System.Xml contains classes related to Xml reading and writing and System.Xml.XPath namespace contains the classes that define a cursor model for navigating and editing XML information items as instances of the XQuery 1.0 and XPath 2.0 Data Model.

Step2:Create a XMLText Reader and load the XML Document

XML Text reader provides a fast , non cashed forward only access to XML data where as XML Document object can be used to load an XML formated file.

Step 3 :Create an XML Node List and iterate the values.

Upon running the code you can see that the values got populated to the array list from the xml.

XML Config File
Code block

Quick watch values

Wednesday, February 17, 2010


Datafox – BSNL BB usage monitor Addon for Firefox

DataFox is a bandwidth usage monitor for BSNL DataOne and MTNL TriBand. It is a cross platform extension written for Firefox that shows data usage statistics on the Firefox status bar. It’s an absolutely great add-on for BSNL BB user
If you’re using Firefox, click here to install the extension directly



To begin with, you must download the files below first(around 400KB in total). All the files should be in the same directory(flex.exe is standalone but bison.exe is not).

Another requirement is that you must have a c/c++ compiler(like Turbo C++ ) installed in your system. I believe everyone who has reached compiler level programming will have a c/c++ compiler installed in their system(duh!).

Now you can start your work.

1. Create a lex program and save it(like ‘x.l’ or ‘x.txt’)

2. Reach your directory through command prompt.

3. Call flex by “flex ” (eg: “flex x.l”)

4. If your lex input file doesnt have any errors, a file name “lex.yy.c” will be generated.

5. I suggest you rename “lex.yy.c” to some other more sensible name like “lex.c”, because double extensions is not a good idea in windows environment. Move the file to the folder of your compiler.

6 . Call the compiler and input lex.c to it (eg: “tcc lex.c”, where tcc is the Turbo C compiler; use any C/C++ compiler you have). If what you have is a more sophisticated environment like visual studio, you have to do the normal procedure to get a program to compile. If you use Turbo C, an object file “lex.obj’ and the executable “lex.exe” will be generated if there are no compilation problems

7. Thats it. Now just run lex.exe. Its your lexical analyser.
For more details Visit