Upload Multiple Files at a time Under a Button Click using Asp.Net C# VB.Net

Most of our project we have to develop a module to upload file/files. Its a common scenario for all developers. In classic ASP it was tedious but in ASP.NET we found a nice control to upload/store a file into the web server. The new control in ASP.NET is capable to do everything except few limitations like filtering, selecting multiple files at a time etc. So in this article I want to describe every aspects like uploading different type of file(s) with effective filtering, Security etc.

Read more ›

Posted in .Net, Asp.net, C#, VB.Net

How to Detect Page Refresh in Asp.net C# VB.Net

Most of the forum I found this problem. That’s why in this article I will try to explain how one can detect Browser Refresh button has been clicked by user. Why detection is necessary because let you have an entry page, when user click to save button then the data saved into the database. The problem is now if user click on Browser Refresh button then the same set of data again inserted into the database because Refresh button always perform user last action. Which is the problem as well as this article will provide the resolution. We will use this technique to resolve this issue.

Read more ›

Posted in .Net, Asp.net, C#, VB.Net

Bind Images from Folder to DataList to Create Image Album in Asp.Net C# VB.Net

If you are looking for how to bind images from database to DataList or GridView I hope you will get a lot of example for it. But in this article here I will show you “How one can bind images from server folder to a DataList to create an Image Album Page“. Its a bit easy in Asp.Net since Asp.Net provides us a really efficient namespace “System.IO”. In this post I will first read the folder where images stored then read all file names if file has a valid extension for images then stored into a list. After that i will bind those list into the DataList. Within DataList I will use an Image control and HyperLink control to display images & name respectively. Here you can also filter image file extension like bmp, jpeg, jpg, png, gif whatever you want. In this example I only consider Jpeg, Jpg, Gif format files or images. You may also like my another post “Display Original Image size in a Popup Window“.

Read more ›

Posted in .Net, Asp.net, C#, VB.Net

How to Convert SqlDataReader or DataReader to DataTable in Asp.Net C# VB.Net

In many cases we need to convert SqlDataReader or DataReader to a DataTable to meet some technical challenges. Here I will show you how to convert SqlDataReader to a DataTable in a simple way. To understand the example please read the article from beginning to last.

Read more ›

Posted in .Net, Asp.net, C#, VB.Net

How to convert SqlDataReader or DataReader to DataSet in Asp.Net C# VB.Net

In some cases most of the Asp.Net C# VB.Net developers need to convert SqlDataReader or DataReader to a DataSet to meet some technical challenges. Here i will show you how one can convert SqlDataReader to a DataSet in a simple way. The code sample is given below:

Read more ›

Posted in .Net, Asp.net, C#, VB.Net

ERROR: The process cannot access the file because it is being used by another process

In most of the cases specially in image manipulation time developers faced an error like:
The process cannot access the file because it is being used by another process.

Read more ›

Posted in .Net, Asp.net, C#, VB.Net

Convert DataTable to DataView in Asp.Net C# VB.Net

The following sample code will demonstrate the conversion from DataTable to DataView in C# & VB.Net in VS 2010. In VS 2010, DataView have one method which accept datatable as input parameter and it return the converted result as DataView by using DataView() method & it takes one argument which is the corresponding DataTable. Ok now look at the conversion of DataTable to DataView example code:

Read more ›

Posted in .Net, Asp.net, C#, VB.Net

Run-time Error: Control ‘controlname’ of type ‘Button’ ‘TextBox’ ‘GridView’ ‘CheckBox’ must be placed inside a form tag with runat=server Asp.Net C# VB.Net

I found this error in Asp.Net when i am trying to add a control dynamically in the page. The error is Control ‘controlname’ of type ‘Button’ must be placed inside a form tag with runat=server. The error comes when you trying to add a control like GridView, Button, TextBox, RadioButton, RadioButtonList, CheckBox, CheckBoxList out side the form tag of your aspx page in runtime or dynamically. There were another reason you may add those controls in your page under form tag but when you open it in other editor like dreamweaver and drag those controls then might be a chance that the control positioned outside the form tag. This type of problems solution is, just place those controls inside the form tag. The error is:

Read more ›

Posted in .Net, Asp.net, C#, VB.Net

Bind Enum Data Type into DropdownList control in Asp.Net C# VB.Net

In some cases we need to bind Enum data into a DropdownList. So in this article or tutorial I will explain “How one can bind Enum into a DropdownList in Asp.net“. After searching a lot of time, I found all codes are inline but I want to control enum from a single class for better manageability & re usability. As a developer we need Enum in most cases like Status,Type etc. So that I want to encapsulate all my necessary Enums of my project into a single class. Here I will show you how you can easily manage Enums Data Type in your project and use multiple times in your pages whenever required.

Read more ›

Posted in .Net, Asp.net, C#, VB.Net

Runtime Add Dynamic Button Control and Handle Click Event in ASP.Net C# VB.Net

In most of the cases developers need to add dynamic controls in asp.net application using code behind or run time. Here in this article i will explain how one can add dynamic Asp.Net Server side Button Control in run time and assign or handle click event in asp.net using C# and VB.NET.

Read more ›

Posted in .Net, Asp.net, C#, VB.Net