June 11, 2014

Creating DOM in jQuery

Document Object Model in HTML or XML is a well-formed document with HTML tags or XML elements.
With jQuery, we can create DOM using ‘createElement()’ method. Many times, while programming, there may situations arise when you have part of HTML in string format and need to query it to find a particular value of tag, defined in it. In such cases DOM plays a vital role to achieve it.
Mechanism is simple, first create a DOM object with HTML string and then find for the element in the DOM object. In jQuery, you can create DOM object as:

var dom = document.createElement('div');

While programming, I got trapped in a situation where I need to find ‘span’ tag value on click event of a ‘div’ element. The scenario was, it was bound with a nested ‘div’ and was returning complete element having multiple HTML tags and I had to find single value – Transaction Number, to display the corresponding detailed information. The same I am sharing here with you.




Now, you can easily find element from the above, using simple jQuery syntax.

var val = $(dom).find("span").text();

And the above code will return: ‘TRANS00007’ without worrying about to manipulate long string.

Hope, it will be useful for you somewhere.

March 6, 2014

C# Most FAQ in Interview

  1. What is the difference between Abstract class & Interface? When to use Interface and when to use Abstract class?
  2. What is the scenario for multiple inheritances? Can you give an example?
  3. What are differences between IQueryable & IEnumerable?
  4. What are the difference between List & IEnumerable? Which is better?
  5. What is anonymous type? What is the difference between ‘var’ & ‘dynamic’?
  6. Can you explain about dependency injection?
  7. What are delegate and multi-cast delegate?
  8. What is anonymous method? 
  9. What is the lambda expression and expression tree?
  10. What is Lazy loading in C#?
  11. What is generation mechanism in memory management?
  12. What is extension method?
  13. What is the difference between finally and finalize?
  14. What is a strong name in assembly? What is satellite assembly?
  15.  What is delay signing? What are the type of signing in assembly & whats the difference?
  16. What are the types of inheritance? Describe all.
  17. What is the difference between a class & structure?
  18. What is a virtual class? Why we use virtual class?
  19. Suppose I need to use an DLL & I want to overwrite DLL method. What are the steps to achieve this?
  20. What is serialization? Why we use it? What are the types of serialization?
  21. What is a threading? What are its different types?
  22. What is "yield" keyword in C#?