Cascade GridView In ASP.NET

Hi Guys,

Have you ever used cascading GridView (GridView inside another GridView) ? I recently got a chance to work on an project where I have to display data in Master Detail relationship so I thought why don’t I used GridView to display detail data with displaying data along with Master data so tried to use Gridview inside a parent GridView. Continue reading

Merging of Data Table in SQL Server

Hi Guys,

This article will demonstrates how to merge two different datatables in sql into single table.Let’s assume there are 2 datatables and we have to merge both the datatables on the basis of Employee Id then, Continue reading

Class Vs Struct in C#.NET

Hi guys ,

This article describe the difference between a class and struct data type in C#.NET

Class:
    A class is a reference type.
    A class is a user defined data type that behaves like built in data type.
    While instantiating a class, .NET runtime engine allocates memory for its instance in heap.
    Classes support inheritance.
    Variables of a class can be assigned as null.
    Class can contain constructor/destructor.

Structure:
    A structure is a value type.
    A structure is a user defined data type that behaves like built in data type.
    In structure, memory is allocated on stack.
    Structures do not support inheritance.
    Structure members cannot have null values.
    Structure does not require constructor/destructor and members can be initialized automatically.

Deleting multiple checked items from a ListView

Hi Guys,

During developement we do encounter some scenarios where user has checked some of the items from the
ListBox and want to delete those selected items on a single button click.
Below is the code sample that i wrote to do the same stuff.

protected void btndelete_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); if (Session["CurrentTable"] != null) { dt = (DataTable)Session["CurrentTable"]; int j = 0; for (int i = 0; i < listview1.Items.Count; i++) { ListViewDataItem items = listview1.Items[i]; CheckBox chkBox = (CheckBox)items.FindControl("chkdel"); if (chkBox.Checked == true) { dt.Rows.RemoveAt(j); dt.AcceptChanges(); } else { j++; } } Session["CurrentTable"] = dt; listview1.DataSource = dt; listview1.DataBind(); BindDataToGridviewDropdownlist(); }

NameValueCollection In C#.NET

Introduction: In this article we will see what is NameValueCollection  class provided by .NET and when to use this class.

Description:

1.       It’s a data structure that store data in Key(String) and Value(string) format.
2.       It allows user to store multiple(duplicate) values for the same Key.
3.       You can access data either via Key or via index.
4.       It’s very similar to HashTable that also allow you to store data in Key and Value format.
5.       When you add a value in the NameValueCollection , Its size grows automatically by relocation.
6.       This class is situated in System.Collections.Specialized namespace.
7.       Its performance is very poor than any other data structure like List, Dictionary or Hash Table so you must be very careful while choosing this data structure unless you tested it for performance. Continue reading