Tuesday, April 24, 2012

Differnce between new and override

It is asked very frequently, that how can we call the parent version of a method in inheritance. In C# we can use new keyword to define a new method in child class and get this effect. I have mentioned a little example that will illustrate you the difference between override and new keyword :


//Calls Base class function 1 as new keyword is used.

BaseClass bd = new DeriveClass();

bd. function ();



//Calls Derived class function 2 as override keyword is used.

BaseClass bd2 = new DeriveClass();

bd2. function ();




Thank You. Happy coding....

Tuesday, April 17, 2012

Drag Events on IOS Devices using JQuery

These issues arise many times when you create a site e.g. on Asp.net with JQuery and some of the events doesn't work at all... Events like Drag drop, double click gestures.... 

We will talk about drag drop events in this case. Assuming that Drag drop events are working perfecting fine on the normal system browsers, here is the way to make it work for smart devices and tablets.

1. Add "touch-punch.min.js" file on your project.
2. Add the following line on your aspx page or control:

<script src="jquery.ui.touch-punch.min.js"></script>
 
3.  Now just add this line on the script portion

<script>
$('#widget').draggable();
</script>
 
 
That's it. You just need to add few lines and your website will now support drag drop gestures
on an iPhone/iPad/iPodTouch. 
 
 Happy coding!!!
 
Click on this link to download the script. 

Thursday, April 12, 2012

Images are not appearing in IIS 7-7.5

Today I have found a funny issue in my asp.net site deployment in IIS 7 on windows server 2008. After deploying my site, I was unable to see images. Initially, I though its a permission issue. I gave IIS_IUSR permission to deployment directory but nothing happened. I tried to reconfigure i.e. broswer settings but nothing turns in my way.

After that I started doing some RND towards IIS settings. I was amused to identify that in IIS, I didn't check static content under WWW Services and it was the reason that my images are not appearing. After enabling the following setting the images started appearing.I hope it would be helpful for you guys.. :)

Tuesday, February 14, 2012

Difference between Theme and StyleSheetTheme

Just like me, you may have wondered why there is theming options in ASP.NET - Theme and StyleSheetTheme. Understanding this difference may help you implement styling in your web page.

Theme overrides the styling applied by control attributes, on the other hand StyleSheetTheme do not override them.

Lets see an example of what is meant by the above line.

Say, we have a have a page Default.aspx which declares the page directive,

<%@ Page Theme="MyTheme" %>

If MyTheme contains a skin file which defines the style for default Label control



now if we use a label control in our Default.aspx page like below,



The label control's text will be in Blue color, becuase Theme always forcefully overrides the Styling attributes declared in the control level.

Now if we change the Page directive to use StyleSheetTheme,

<%@ Page StyleSheetTheme="MyTheme" %>

Now the label control font will be in Red as the StyleSheetTheme will no more override the inline style attribute.

If we look at the order in which the styling is applied we may get a more clear idea.

1. Theme attribute in the Page directive.
2. Theme declaration element in the Web.config file.
3. Local control attributes.
4. StyleSheetTheme attribute in the Page directive.
5. StyleSheetTheme element in the Web.config file.
Earn Money ! Affiliate Program
Open Directory Project at dmoz.org