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.

Sunday, December 25, 2011

ASP.NET AJAX and Sys.Debug

ASP.NET includes tracing functionality that can be used to track different issues in an application. It can be used to easily inspect errors that have occurred, check sessions IDs, cookie values, ViewState size, server variables plus a lot more.

The ASP.NET AJAX client script library also includes basic tracing functionality that can be used to write trace messages to a console window (that show up while debugging) or to the actual page. The client-side tracing functionality can also be used to dump values contained within a JSON object so that they are easily viewed. All of this client-side tracing functionality is exposed by the Sys.Debug class. An example of using it to write a trace message to the console and dump the contents of an Album object is shown next:


Adding calls to Sys.Debug.trace() will cause the trace information to be shown in the Visual Studio .NET 2005 console window while debugging, but the trace information won't be shown in the page. In cases where you'd like to see the output of different trace statements directly in the page you can add a textArea tag and give it an id of TraceConsole :

<--textarea id="TraceConsole" -->
Earn Money ! Affiliate Program
Open Directory Project at dmoz.org