<script type="text/javascript">
var TotalChkBx;
var Counter;
window.onload = function()
{
TotalChkBx = parseInt('<%= this.GridView3.Rows.Count %>');
Counter = 0;
}
function SelectAll(CheckBox)
{
var TargetBaseControl = document.getElementById('<%= this.GridView3.ClientID %>');
var TargetChildControl = "chkselect";
var Inputs = TargetBaseControl.getElementsByTagName("input");
for(var n = 0; n < Inputs.length; ++n)
if(Inputs[n].type == 'checkbox' && Inputs[n].id.indexOf(TargetChildControl,0) >= 0)
Inputs[n].checked = CheckBox.checked;
Counter = CheckBox.checked ? TotalChkBx : 0;
}
function ChildClick(CheckBox, HCheckBox)
{
var HeaderCheckBox = document.getElementById(HCheckBox);
if(CheckBox.checked && Counter < TotalChkBx)
Counter++;
else if(Counter > 0)
Counter--;
if(Counter < TotalChkBx)
HeaderCheckBox.checked = false;
else if(Counter == TotalChkBx)
HeaderCheckBox.checked = true;
}
</script>
onclick="javascript:SelectAll(this);"
Thursday, June 14, 2012
Javascript code to check/uncheck all checkboxes from header check box
GridView Events Summary
Introduction
In this article i have tried to summarize all the events of grid view which i came across.
What is a GridView?
The DataGrid or GridView control displays data in tabular form, and it also supports selecting, sorting, paging, and editing the data inside the grid itself. The DataGrid or GridView generates a BoundColumn for each field in the data source (AutoGenerateColumns=true). By directly assigning the data source to the GridView, the data can be rendered in separate columns, in the order it occurs in the data source. By default, the field names appear in the grid's column headers, and values are rendered in text labels. A default format is applied to non-string values and it can be changed.
GridView Fields
| Column Name | Description | | |
BoundColumn | To control the order and rendering of columns. | ||
HyperLinkColumn | Presents the bound data in HyperLink controls | ||
ButtonColumn | Bubbles a user command from within a row to the grid event handler | ||
TemplateColumn | Controls which controls are rendered in the column | ||
CommandField | Displays Edit, Update, and Cancel links in response to changes in the DataGrid control's EditItemIndex property. |
Wednesday, June 13, 2012
OOPs Concept
- A class is a user defined data type that behaves like a built in data type.
- A class acts as a blueprint for an object.
- A class contains all the attributes and behavior of an object.
- A class is a wrapper/container of an object.
- A class doesn’t occupy apace in memory.
Object
Instance of Class is called object. An object is created in memory using keyword “new”.
- An object is an instance of a class.
- It is a run time entity.
- Anything in this real world can be termed as object.
- An object possesses attributes and behavior.
- An object occupies space in memory and utilizes CPU processing.
Object Serialization in the .NET Framework
Introduction
Serialization can be defined as the process of storing the state of an object instance to a storage medium. During this process, the public and private fields of the object and the name of the class, including the assembly containing the class, is converted to a stream of bytes, which is then written to a data stream. When the object is subsequently deserialized, an exact clone of the original object is created.
When implementing a serialization mechanism in an object-oriented environment, you have to make a number of tradeoffs between ease of use and flexibility. The process can be automated to a large extent, provided you are given sufficient control over the process. For example, situations may arise where simple binary serialization is not sufficient, or there might be a specific reason to decide which fields in a class need to be serialized. The following sections examine the robust serialization mechanism provided with the .NET Framework and highlight a number of important features that allow you to customize the process to meet your needs.
JSON – Serialization and Deserialization
{“firstName”: “Rakki”,“lastName”:”Muthukumar”,“department”:”Microsoft PSS”,“address”: {“addressline1”: “Microsoft India GTSC”,“addressline2”: “PSS - DSI”,“city”: “Bangalore”,“state”: “Karnataka”,“country”: “India”,“pin”: 560028}}