Category - C#.Net
19 Feb 2008
4 Comments   53894 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   46413 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   28526 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   31091 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   83637 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
11 Comments   44820 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
6 Comments   27826 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   186201 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
44 Comments   209079 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   39994 Views
Here Mudassar Khan has explained How to display images that are stored outside the Website Root Folder
22 Mar 2009
18 Comments   46556 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   71358 Views
Here Mudassar Ahmed Khan has explained how to find the control that caused the postback in ASP.Net
12 Apr 2010
20 Comments   38998 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   14612 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   15413 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   24928 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   17999 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   59233 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   51425 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   31012 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   7542 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
14 Comments   63359 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   76366 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   60584 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
8 Comments   34933 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   15066 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   26489 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
2 Comments   21643 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   32163 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   32480 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
1 Comments   8053 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   32515 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   23010 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   14662 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   7101 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   9982 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   5879 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   22434 Views
Here Mudassar Ahmed Khan has explained, how to populate DropDownList from XML file in ASP.Net
07 Aug 2013
5 Comments   24337 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   16949 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   18235 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   3709 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
1 Comments   36140 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   15543 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
9 Comments   27029 Views
Here Mudassar Ahmed Khan has explained, the difference between ArrayList and Generic List (List) in C# .Net and VB.Net.
05 Sep 2013
2 Comments   9151 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
6 Comments   42898 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   10841 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   17012 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   12092 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
2 Comments   15971 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   8696 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   2315 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
2 Comments   2415 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   1499 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
1 Comments   1971 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
0 Comments   1598 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   1372 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   1157 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   1049 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
0 Comments   963 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   870 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   771 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   1022 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
0 Comments   949 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.