hits counter
  Create Free Blog | Random Blog »   Report Abuse | Login   

 

Archive for the 'Code Snippets' Category

Extracting HTML source from a URL website

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 [...]

Exception Handling .NET Try Catch Finally Block working

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 [...]

Crystal Report toolbar images not Displayed ASP.NET

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 [...]

How StringBuilder string concatenation affects performance , string builder vs string concatenation “+”

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 [...]

Sending a Appointment programmatically through Code , ASP.NET ,ICalendar Format

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 [...]

Datagrid Sorting ASP.NET or How to Sort Datagrid

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 [...]

Sending Appointment through .NET

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 [...]

StringBuilder append Vs String Concatenation “+”

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 [...]