In this blog I will show how to make custom handler to handle custom extensions. You may be familiar with .ASPX, .ASHX, .ASMX etc extensions, now how to handle the situations where we have the custom extensions say ".MyOwnExtension" . Let's start making our own custom handler to handle the extensions ".raghav" . Create a ClassLibrary Project and then a custom class "RaghavHandler" inheri...
In this blog I will show how to make a simple jQuery tooltip plugin. Generally we need to show tooltips on hyperlinks t o show some information or detail regarding the link. Below is the screenshot how the tooltip will be displayed. Let's start writing the jQuery plugin. Here is the code for it : /* Tooltip plug-in */ (function ($) { $.fn.extend({ tip: function (options) { var defaults =...
Today I have read a question on forums asp.net. So I thought I should write a blog on this. Question - How do I get Date, month, year in three different dropdownlist? Well below you will see you how we can show Date, Month and Year in three different dropdownlist. Code - <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title>...
Difference between HttpModule and HttpHandler in .NET This is quite a popular question in most .NET interviews, and all beginner .NET developers should be able to answer it. In this quick blog post I will try to simply the difference between these two pillars of ASP.NET programming model. To start with, it is very important to understand that all ASP.NET requests are handled by a web ser...
Short intro Many developers have already written some blog posts or articles regarding this subject. In the following blog, I will try to explain the concepts of using Events and Delegates in C#.NET and will try to keep it as simpler as possible, in order to give clear view to all those who are confused, especially about delegates . The first time I’ve started learning about C#.NET from ...
Today (15 October 2010), ScottGu has posted a blog announcing a patch for one of the top issues with VS.NET 2010 reported by the users in Microsoft Connect, the Scrolling Context Menu. You can read ScottGu's blog here or you can go directly to the patch download page . There are actually two patches, one for VS.NET and another for WPF Hope this info is helpful. Regards, Hajan
As a capability, URL routing was first time introduced in ASP.NET 3.5 SP1. The URL routing is well known in the ASP.NET MVC, but it can be also implemented in ASP.NET Web Forms Framework. URL routing can help a lot in Search Engine Optimization (SEO). What is it all about? Transforming the physical path of the URL to virtual path with different semantically meaningful URL name, easier fo...
Hi, Here i am wirtting this bolg because, .net has great support for regular expressions, and it's hard to do input validation without them.My breaking point came this past 15days, as i wrote yet another coplicated method to comma delimited lists of integers. Well, for one thing, just about every article and book out there is geared towords using regular expression in text searches, rath...
Hi, I am writing this blog because, Reflection provides higher level abstraction, actually using reflection we can examine the object and handle that object at run time as per our requirement. For example, just before some time using reflection i am searching parent of the current object, and used that information for error logging purpose. objMethodBase = system.reflection.methodbase; P...
Today a person asked on the forums on how to call a function or execute a JavaScript code after UpdatePanel processing is completed. I decided to write a blog on the solution which I gave to him. Actually we need to hook the events which are fired when the update panel is done with its processing and the event is Sys.WebForms.PageRequestManager endRequest Event. From MSDN : Sys.WebForms....
Few days back a person asked on the forums on how to add and remove rows in a table with jQuery. I have decided to write a blog on the solution which I gave to him. I have created a sample code in which I have used a table and two input buttons. The first one is for adding a new row and the second one for removing the row. Here is the source: <html xmlns="http://www.w3.org/1999/xhtml"...
Every Beginner have confused about IsPostBack property. Below you will find a very simple example of IsPostBack property. IsPostBack property returns Boolean value. It is used to determine if data is being sent back to the Web server or if the Web page is simply being requested. Example :- <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled...
We all know how to get the html of an element with jQuery but what if we need the selector itself included in that html ?What I mean to say is suppose there is a selector <div id="foo" >foo</div> now simply calling $('#foo').html() will only return inner html i.e. "foo" only but we need the full html included selector too i.e. "<div id="foo" >foo</div> ". Below is...
In this blog I will show you hot create mutually exclusive checkboxes functionality with jQuery. By mutually exclusive it means at a time only one element will be selected not more than that. Below is the sample code: <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/...
In this blog I will show how to get the value of a ASP.NET label with jQuery, though it is a simple but it will help the starters in jQuery. I have created a sample code in which I have used one ASP.NET label and one ASP.NET input button. On clicking the input button the value of the label will be displayed in an alert box. Here is the source: <html xmlns="http://www.w3.org/1999/xhtml...
In this blog I will show how to replace everything in a string which is not alphanumeric with REGEX. I have used "[^a-zA-Z0-9]" as the pattern. Below is the complete sample code: #region Using Directives using System; using System.Text.RegularExpressions; #endregion public class Example { static void Main() { var regex = new Regex("[^a-zA-Z0-9]", RegexOptions.None); const string input = ...
In this blog I will show you how to manually close the colorbox modal with a button or an anchor's click. By default the colorbox modal provides you with a close link but if you need to still close it by some action this blog will will help you. From the colorbox plugin I found that in order to manually close it we need to execute "$.fn.colorbox.close()". Below is the sample code: <ht...
Today we had a requirement where we were having the number of hours difference as the input and we need to extract the the timezoneid (from the timezoneinfo object) as the output. Below is the script: using System; using System.Linq; class Sample { public static TimeZoneInfo GetTimeZone(double hoursDifference) { return TimeZoneInfo.GetSystemTimeZones() .First(x => x.BaseUtcOffset.Tota...
Difference between const and static readonly keywords C# If in your C# class you want to use a variable whose value will not change during the lifetime of that class, then you have two options: 1. Use the "const" keyword: for e.g. public const int myVar = 100; 2. Use the "static readonly" keyword: for e.g. public static readonly int myVar = ConfigurationManager.AppSettings["value"]; The ...
User Interface development tools A number of tools exist which provide help for developing web solutions, here are few tools outlined below. Tool Browser Address Tool Use Fiddler ALL http://www.fiddlertool.com/fiddler/ Provides http tracing which is useful for debugging JSON posts. Web helper developer IE http://projects.nikhilk.net/WebDevHelper Provides http tracing and logging with an ...
Difference between a dedicated server, shared server, VPS and cloud hosting? Before the advent of the buzz-word "cloud", there were primarily 3 major hosting options for your web applications: 1. Shared Server : You share the server space and hardware (RAM, Disk size, CPU etc) with others on a single server. The server admin will allocate you a fixed hard disk space (database may be incl...
In this post I will discuss how to create a file watcher utility and perform some tasks if a file is created, deleted, changed or renamed. FileSystemWatcher Class listens to the file system change notifications and raises events when a directory, or file in a directory, changes. We can use FileSystemWatcher to watch for changes in a specified directory or can watch for changes in files a...
In forum one member ask "how upload a file to server automatically ". So here I will discuss how we can implement a File Transfer Protocol (FTP) client in .NET. .NET Framework provides a class FtpWebRequest by using this class we can perform basic ftp operations as following. AppendFile Represents the FTP APPE protocol method that is used to append a file to an existing file on an FTP se...
ScottGu wrote a new blog posts with the most frequently asked questions regarding the newest asp.net security flaw. Here is his blog post: http://weblogs.asp.net/scottgu/archive/2010/09/20/frequently-asked-questions-about-the-asp-net-security-vulnerability.aspx
Here I have discussed about how to get all the dates of any Dayofweek in a year. Below is the stpes to caluclate all Dayofweek in a year. 1. Initialize a Collection for adding all Sundays in that. Collection<DateTime> listOfSundays = new Collection<DateTime>() 2. For that first we get the start date of the year as follows: DateTime startDate = new DateTime(year, 1, 1); 3. Now...
It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.
enter your email address:
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18