Archive for the 'Code Snippets' Category
Was just thinking of trying something short and sweet and thought of trying out a snippet for extracting code from the entered url.
Following is the code have not declared the namespaces on top but used them directly in the code to bring more clarity on which namespace the object comes from.
The code is self explanatory [...]
August 16th, 2009 | Posted in .NET, Code Snippets | No Comments
Exception handling and performance
The vanila try- catch statement:
try
{
// Execute the code for SQL
}
Catch(Exception Ex)
{
// Handle the exception.
}
In the above example the try catch encapsulates a piece of code executing some DB operations.
In case there is an exception thrown in the try block code the exception will be smartly catched in the catch block [...]
October 11th, 2008 | Posted in .NET, Best Practices, Code Snippets, Problem Solving | 3 Comments
Reposting from old blog
One of my colleague faced a strange problem while using Crystal Reports
He got his report published on the ASPX page but the images in the toolbar weren’t being displayed.
While trying to find out the problem for it I checked the ASPX page and noticed that the src path for the images on [...]
September 10th, 2008 | Posted in .NET, Code Snippets, Crystal Reports, Problem Solving | No Comments
reposting from older blog
How String Concatenation String Builder Append affects performance
Most of us have used String concatenation in our projects, Have we ever given a thought to what goes on behind while concatenating the strings?
There is a major flaw in using string concatenation as against the String builders append concerning performance only.
Except for [...]
September 10th, 2008 | Posted in .NET, Code Snippets, Problem Solving | No Comments
Here is in which you can send appointments via ICalendar format through code and not using the Outlook Object library (This is a very basic version of the way and does not involve much exception handling,and doesnt take care of nth case , explore a bit on that front :))
I am going to show the [...]
September 10th, 2008 | Posted in .NET, Code Snippets, Problem Solving | No Comments
Datagrid Sorting ASP.NET or How to Sort Datagrid
Step I )
In the Datagrid definition:
add 2 properties AllowSorting = true and OnSortCommand=”MethodName in code behind”
e.g
<asp:datagrid id=”dgSearchList” runat=”server” Height=”125px” Width=”627px” CssClass=”panelChildSolidBorder”
CellPadding=”2″ AllowCustomPaging=”True” AutoGenerateColumns=”False” OnItemCommand=”detailsClicked”
ShowHeader=”True” AllowSorting=”True” OnSortCommand=”dgSearchList_SortClick” PageSize=”4″>
AllowSorting=”True” makes the datagrid sortable and OnSortCommand=”dgSearchList_SortClick” tells which method to call when the header is clicked.
Step [...]
September 10th, 2008 | Posted in .NET, Code Snippets, Problem Solving | No Comments
I had to create a Appointment by parsing through the database and then sending a particular guy a appointment which would remind him about the appointment approx 15 mins before the scheduled time. The same way in which Outlook Appointment functions.
Searching a bit, I found a way to utilise the Outlook Object library and send [...]
September 10th, 2008 | Posted in .NET, Code Snippets | No Comments
For all of you looking for proof that Stringbuilder is faster than the normal string concatenation using “+”
In the following code snippet i have used both the methods and used start time and end time in each method to calculate the Elasped time for each respective method Create a new project and add the [...]
September 10th, 2008 | Posted in .NET, Code Snippets, General | No Comments