Category - C#.Net
19 Feb 2008
4 Comments   64964 Views
Here Mudassar Ahmed Khan has explained how to use parameterized queries to query SQL Server database in order to avoid SQL Injection attacks
31 Jan 2009
1 Comments   51571 Views
Here Mudassar Ahmed Khan has explained how to export data to Microsoft Excel workbook using ADO.Net and C#
01 Feb 2009
1 Comments   29942 Views
Here Mudassar Ahmed Khan has explained how to make AJAX Calls using JavaScript and XMLHttp to fetch data from server in ASP.Net
03 Feb 2009
1 Comments   32636 Views
Here Mudassar Ahmed Khan has explained how to use AJAX JavaScript and XMLHttp to query the server and find out whether user name already exists in the database using C and Vb.Net
04 Feb 2009
10 Comments   90501 Views
Here Mudassar Ahmed Khan has explained how to read and import data to Microsoft Excel workbook using ADO.Net and C#
12 Feb 2009
12 Comments   50716 Views
Here Mudassar Ahmed Khan has explained how to send emails using C# and asp.net. He has also explained how to send emails on a new thread to improve performance.
15 Feb 2009
7 Comments   33185 Views
Here Mudassar Ahmed Khan has explained how to attach files to email without saving them onto the disk directly from the FileUpload stream
19 Feb 2009
78 Comments   191211 Views
Here Mudassar Ahmed Khan has explained how to save file as binary data inside SQL Server database and also how to retreive them and reconvert to their respective formats using VB.net amd C#.
21 Feb 2009
47 Comments   265902 Views
Here Mudassar Ahmed Khan has explained how to retrieve and display images that are stored in SQL Server Database in ASP.Net Web application
21 Feb 2009
8 Comments   51028 Views
Here Mudassar Khan has explained How to display images that are stored outside the Website Root Folder
22 Mar 2009
18 Comments   54769 Views
Here Mudassar Ahmed Khan has explained how to pull RSS from a website and display the same on the web page using ASP.Net
06 Apr 2009
10 Comments   87565 Views
Here Mudassar Ahmed Khan has explained how to find the control that caused the postback in ASP.Net
12 Apr 2010
20 Comments   45272 Views
Here Mudassar Ahmed Khan has explained how to call parent page method from child user control placed on the same page whose function or method we want to call.
25 Apr 2010
2 Comments   17149 Views
Here Mudassar Ahmed Khan has explained how to Populate and Bind Custom Business Objects or properties collection to databound controls like ASP.Net GridView Control
13 Jun 2010
4 Comments   18030 Views
Here Mudassar Ahmed Khan has explained how to bind an XML or XML File to ASP.Net DropDownList Control using DataSet in C# and VB.Net
01 Jul 2010
0 Comments   31954 Views
Here Mudassar Ahmed Khan has explained how to preserve values or states of custom properties across postbacks in ASP.Net
24 Jul 2010
3 Comments   22048 Views
Here Mudassar Ahmed Khan has explained how to make use of the new feature Parallelism in .Net 4.0 making use of the new classes Parallel and PLINQ (Parallel LINQ)
18 Dec 2010
4 Comments   147928 Views
Here Mudassar Ahmed Khan has explained how to list the installed instances of SQL Server on machine and LAN Network using C# and VB.Net
27 Dec 2010
18 Comments   62013 Views
In this article Mudassar Ahmed Khan has explained how to read emails from POP3 server using OpenPop.Net Library using C# and VB.Net
03 Jan 2011
10 Comments   36896 Views
In this article Mudassar Ahmed Khan has explained how to read emails from POP3 server using OpenPop.Net Library using C# and VB.Net
04 Jan 2011
1 Comments   8393 Views
Here Mudassar Ahmed Khan has explained the difference between string and String keywords in C# and also the difference between bool and Boolean class.
13 Apr 2011
16 Comments   76422 Views
Here Mudassar Ahmed Khan has explained how to create and send HTML Formatted Emails in ASP.Net using C# and VB.Net
25 Apr 2011
11 Comments   98115 Views
Here Mudassar Ahmed Khan has explained how to implement the free ASP.Net Mathematical Captcha Control in C# and VB.Net
07 Aug 2011
3 Comments   83485 Views
Here Mudassar Ahmed Khan has explained the exception DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID' in ASP.Net
17 Aug 2011
9 Comments   42939 Views
Here Mudassar Ahmed Khan has explained how to modify the ASP.Net WCF (Windows Communication Foundation) service to make it accept AJAX JSON calls and to make AJAX JSON calls to ASP.Net WCF Service using JavaScript and jQuery
02 Nov 2011
0 Comments   17373 Views
Here Mudassar Ahmed Khan has explained how to get distinct list of custom business class objects using LINQ Query in .Net
08 Feb 2012
4 Comments   32792 Views
Here Mudassar Ahmed Khan has explained how to convert Text string to Image using C# and VB.Net in ASP.Net Web application and display the converted image in Image Control
21 Feb 2012
3 Comments   28672 Views
Here Mudassar Ahmed Khan has explained how to programmatically add and update SQL connection strings in ASP.Net Web.Config file using C# and VB.Net.
He has explained how we can access and update the different attributes of a connection string like DataSource, IntitialCatalog, UserId, Password and IntegratedSecurity.
01 Aug 2012
7 Comments   43146 Views
Here Mudassar Ahmed Khan has explained how to fetch and read email messages with attachments from GMAIL POP3 mail server inbox in ASP.Net. The fetched emails are bound to ASP.Net GridView and users are able to download the attachments.
20 Aug 2012
5 Comments   39664 Views
Here Mudassar Ahmed Khan has explained how to send Rich Text HTML Emails with embedded images and pictures using VB.Net and C# in ASP.Net
03 Sep 2012
2 Comments   9441 Views
Here Mudassar Ahmed Khan has explained how to create dynamic button controls at runtime and also attach OnClick event handlers to the dynamically generated buttons in Windows Forms (WinForms) Application using VB.Net and C#.
12 Oct 2012
2 Comments   41059 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code how to minimize Windows Application to System Tray using VB.Net and C#.
29 Oct 2012
0 Comments   30510 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code, how to Populate bind GridView with Generic List in ASP.Net using C# and VB.Net.
Generic Lists are created from Custom Business Objects also known as Property Class
30 Oct 2012
0 Comments   18874 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code, how to bind Generic List to GridView in ASP.Net using C# and VB.Net.
Generic Lists are created from Custom Business Objects also known as Property Class
03 Apr 2013
0 Comments   8851 Views
Here Mudassar Ahmed Khan has explained with an example, how to delete folder or directory using C# and VB.Net
A Directory that contains files or folders cannot be deleted hence this code first deletes all the Child Directories and also all the files in the Directory as well the Child Directories.
10 Apr 2013
0 Comments   14086 Views
Here Mudassar Ahmed Khan has explained with an example, how to recursively all delete all directories (sub directories or folders or sub folders) in C# an VB.Net
16 Apr 2013
0 Comments   6472 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code,
how to send emails using GMAIL Account Credentials in ASP.Net using C#.
27 Jul 2013
0 Comments   34110 Views
Here Mudassar Ahmed Khan has explained, how to populate DropDownList from XML file in ASP.Net
07 Aug 2013
6 Comments   33806 Views
Here Mudassar Ahmed Khan has explained, how to send email with attachment in ASP.Net.

The file to be send as attachment along with mail will be uploaded using FileUpload control and will be dynamically added as attachment in the MailMessage class object without saving in any folder on disk.

For this example, for sending emails Gmail SMTP Mail Server will be used. To send email with Gmail SMTP Server, you will need to use an email address and password of a valid Gmail account and along with that you will need the Gmail SMTP Mail Server settings.
09 Aug 2013
1 Comments   23018 Views
Here Mudassar Ahmed Khan has explained, how to remove (delete) duplicate rows (records) from DataTable using DataView in C# and VB.Net.

The idea is to convert the DataTable to DataView and then from DataView back to DataTable using the DataView ToTable method which has option to return distinct (unique) rows (records) of DataTable, thus ultimately it removes (deletes) duplicate rows (records).
17 Aug 2013
3 Comments   24667 Views
Here Mudassar Ahmed Khan has explained, how to add dynamic controls like Label, TextBox, Button, etc. to Windows Forms ( WinForms ) Application on click of a Button.

He has also explain how we can attach event handler to various dynamically added controls like TextBox, Button, etc.
17 Aug 2013
0 Comments   4980 Views
Here Mudassar Ahmed Khan has explained with an example, how to recursively all delete files in all directories (sub directories or folders or sub folders) in C# and VB.Net
18 Aug 2013
2 Comments   51124 Views
Here Mudassar Ahmed Khan has explained, how to dynamically (programmatically) at runtime create a DataTable using C# or VB.Net and then bind it to GridView in ASP.Net.

First a dynamic DataTable object is created and its schema (Table structure and Columns) is defined programmatically. Once the columns are defined, then rows (records) are added to the dynamically generated DataTable.

Once the dynamic DataTable is populated with records, it is bound to an ASP.Net GridView control.
21 Aug 2013
0 Comments   19416 Views
Here Mudassar Ahmed Khan has explained, how to dynamically create DataTable and bind to GridView in ASP.Net using C# and VB.Net
22 Aug 2013
12 Comments   44024 Views
Here Mudassar Ahmed Khan has explained, the difference between ArrayList and Generic List (List) in C# .Net and VB.Net.
05 Sep 2013
3 Comments   12811 Views
Here Mudassar Ahmed Khan has explained, how to send email with attachment in ASP.Net.

The file to be send as attachment along with mail will be uploaded using FileUpload control and will be dynamically added as attachment in the MailMessage class object without saving in any folder on disk.

For this example, for sending emails Gmail SMTP Mail Server will be used. To send email with Gmail SMTP Server, you will need to use an email address and password of a valid Gmail account and along with that you will need the Gmail SMTP Mail Server settings.
16 Sep 2013
9 Comments   65887 Views
Here Mudassar Ahmed Khan has explained how to use and return value from Stored Procedure using Output Parameter in ASP.Net.

For this article I a Table named Fruits is used which contains FruitId and FruitName columns. The name of the Fruit is fetched using Output Parameter in SQL Server Stored Procedure in ASP.Net
13 Nov 2013
2 Comments   20267 Views
Here Mudassar Ahmed Khan has explained how to programmatically add, modify (change) and update SQL connection strings at runtime in ASP.Net Web.Config file using C# and VB.Net.

He has explained how we can access and update the different attributes of a connection string like DataSource, IntitialCatalog, UserId, Password and IntegratedSecurity.
16 Nov 2013
1 Comments   22410 Views
Here Mudassar Ahmed Khan has explained how to encrypt and decrypt file such as Word (DOC, DOCX), Excel (XLS, XLSX), PDF, Text (TXT) documents or JPG, PNG or GIF Images using C# and VB.Net in ASP.Net website.

The file will be uploaded for Encryption and Decryption of Files. For Encryption and Decryption of files, the AES Symmetric key (Same key) algorithm is used. The encrypted and decrypted files can be saved inside folders on disk or can be downloaded to client user.
02 Jan 2014
0 Comments   20197 Views
Here Mudassar Ahmed Khan has explained how to modify the ASP.Net WCF (Windows Communication Foundation) service to make it accept AJAX JSON calls and to make AJAX JSON calls to ASP.Net WCF Service using JavaScript and jQuery
18 Jan 2014
3 Comments   21993 Views
Here Mudassar Ahmed Khan has explained how to read Excel File using OLEDB Data Provider Connection in C# .Net. Excel Workbook is just like database with sheets corresponding to tables.
This article covers reading of both Excel 2003 as well as OpenXML i.e. Excel 2007, 2010 and 2013 formats.
17 Feb 2014
0 Comments   11966 Views
Here Mudassar Ahmed Khan has explained how to preserve or persists data / class objects / variable values across PostBacks in ASP.Net.

This is done by saving the data / class objects / variable in a ViewState object and then fetching it from it whenever needed.
03 May 2014
1 Comments   6338 Views
Here Mudassar Ahmed Khan has explained how to encrypt and decrypt XML File using C# and VB.Net.

The XML file will be uploaded for Encryption and Decryption of Files. For Encryption and Decryption of files, the AES Symmetric key (Same key) algorithm is used. The encrypted and decrypted files can be saved inside folders on disk or can be downloaded to client user.
12 Jun 2014
4 Comments   7227 Views
Here Mudassar Ahmed Khan has explained how to send or pass DataTable as parameter to Stored Procedure in C# and VB.Net using the SQL Server User Defined Table Type.

The User Defined Table Type has to be created in SQL Server and it must have the same schema as that of the DataTable that we need to pass to the Stored Procedure as parameter.
26 Jun 2014
0 Comments   7340 Views
Here Mudassar Ahmed Khan has explained how to display ‘st’, ‘nd’, ‘rd’ and ‘th’ suffix after day numbers in Formatted Date string using C# and VB.Net.

By default .Net does not have any provision to display the display ‘st’, ‘nd’, ‘rd’ and ‘th’ suffix after day numbers in Formatted Date string and hence I have come up with a generic method for accomplishing the task.
28 Jun 2014
2 Comments   6394 Views
Here Mudassar Ahmed Khan has explained how to dynamically generate PDF in Memory from HTML using iTextSharp and send the generated PDF as Email Attachment using C# and VB.Net.

Using iTextSharp Library, the PDF is generated from HTML string in memory by making use of MemoryStream class and then the same is attached to the MailMessage object and send as email attachment.
03 Jul 2014
2 Comments   6951 Views
Here Mudassar Ahmed Khan has explained how to read and write BLOBs (Binary Large Objects) data to SQL Server database using C# and VB.Net.

BLOBs include files such as Images, PDF, Word or Excel Documents, Audio, Video files. Such files are read converted to an array of bytes and inserted into SQL Server VARBINARY or IMAGE fields.
03 Jul 2014
0 Comments   6122 Views
Here Mudassar Ahmed Khan has explained how to dynamically create PDF from HTML string using iTextSharp and send the generated PDF as Email Attachment in ASP.Net using C# and VB.Net.
04 Jul 2014
0 Comments   5390 Views
Here Mudassar Ahmed Khan has explained with a simple example how to use Parallel ForEach Loop in C# and VB.Net using .Net 4.0 and .Net 4.5.

Parallelism can be achieved in two ways
1. Parallel class
2. PLINQ (Parallel LINQ)

Here he has explained how to achieve parallelism using Parallel ForEach Loop.
04 Jul 2014
0 Comments   2940 Views
Here Mudassar Ahmed Khan has explained what is Parallel LINQ (PLINQ) and a simple example how to write a PLINQ Query in C# and VB.Net .Net 4.0 and .Net 4.5.

Parallelism can be achieved in two ways
1. Parallel class
2. PLINQ (Parallel LINQ)

Here he has explained how to achieve parallelism using Parallel LINQ (PLINQ).
16 Jul 2014
1 Comments   2275 Views
Here Mudassar Ahmed Khan has explained with an example, how to pass Table Valued Parameters to SQL Server Stored Procedure from .Net Code Behind using ADO.Net, C# and VB.Net.
05 Aug 2014
0 Comments   4155 Views
Here Mudassar Ahmed Khan has explained how to pass multiple records (rows) to a Stored Procedure in SQL Server using C# and VB.Net.
We can pass a Table containing multiple records (rows) to a Stored Procedure by making use of Table Valued parameters in SQL Server.
11 Aug 2014
0 Comments   2308 Views
Here Mudassar Ahmed Khan has explained how to save file as binary data inside SQL Server database and also how to retrieve them and convert them back to their respective formats using C# and VB.Net.
11 Aug 2014
0 Comments   2384 Views
Here Mudassar Ahmed Khan has explained how to save image as binary data into SQL Server database and also how to retrieve and convert the image back to their respective formats using C# and VB.Net.
24 Aug 2014
1 Comments   4025 Views
Here Mudassar Ahmed Khan has explained how to create text image on the fly with ASP.Net using C# and VB.Net.

The image generation is done dynamically using GDI+ library in ASP.Net.
24 Sep 2014
0 Comments   1872 Views
Here Mudassar Ahmed Khan has explained how to export data (records) from SQL Server Table to Text (Notepad) file in ASP.Net using C# and VB.Net. This article will work for all SQL Server versions i.e. 2005, 2008, 2008R2, 2012, etc.

The data will be first fetched into a DataTable and then the DataTable will be exported to a Text file which can be viewed in Notepad.
14 Oct 2014
0 Comments   2513 Views
Here Mudassar Ahmed Khan has explained how to export DataGridView data to Excel file in Windows Forms (WinForms) Applications using OpenXml and ClosedXml Excel conversion libraries, C# and VB.Net.

DataGridView cannot be exported directly to Excel file and hence need to generate a DataTable and export the DataTable to Excel file.