Friday, October 24, 2014

How do you clear temporary files in an ASP.NET website project?

All you need to do is stop IIS from Services, go to c:\Windows\Microsoft.NET\Framework\v4.0.30319\ or respective Framework directory, open the Temporary ASP.NET Files and delete the folders

What happens when we delete these files? Is it safe?

Yes, it's safe to delete these, although it may force a dynamic recompilation of any .NET applications you run on the server.

For background, see the Understanding ASP.NET dynamic compilation article on MSDN.

Thursday, October 16, 2014

How To Disable Right Click Using jQuery

There are many different ways where we can disable right click on browser but using jQuery its very easy with one line of code.

Add the below code into the head section of your web page.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(document).bind("contextmenu", function (e) {
e.preventDefault();
});
});
</script>

How To Show A Message When DataList Is Empty

DataList doesn’t have EmptyDataTemplate like GridView or ListView, Here is how we can achieve use FooterTemplate in DataList

<FooterTemplate>
<asp:Label ID="lblEmpty" Text="No test types found." runat="server"
Visible='<%#bool.Parse((SearchValuesList.Items.Count == 0).ToString())%>'> </asp:Label>
</FooterTemplate>